2

https://github.com/Clancey/UICalendarを使用しています

追加したイベントをカスタムデータベーステーブルに行として保存したいと思います。ただし、現在、UICalendarライブラリが実際にこれを行うためのイベントを公開していることはわかりません。UICalendarを使用して追加されたイベントをカスタムデータベースに保存するための最良の方法は何ですか?または、少なくともイベントにアクセスできますか?

どんな助けでも大歓迎です!

[編集]

Looks like I need to use EKEvent to find the currently saved value. How would I get the values from the event currently being triggered to save from my application?

4

2 に答える 2

1

UICalendar はビジュアル コンポーネントのみのようです。独自のコードでストア/ロード イベントを処理する必要があります。たとえば、SQLite-net ORM ライブラリ ( http://code.google.com/p/sqlite-net/ ) を使用します。

UICalendar を使用して systemt カレンダーでイベントを表示/編集する場合はEKEvent、その他のEventKitフレームワーク クラスを使用してその情報にアクセスします。

于 2013-02-27T10:24:32.260 に答える
1

私は実際に UICalendar プロジェクトを自分のプロジェクトにインポートし、この楽しみが始まるCalendarViews.cs行に変更を加えました。258

以下に、アプリケーションのイベントと共に保存する必要があるカスタム データを関連付けるために、イベントをインターセプトするために私が行ったことを正確に示します。基本的に、これはイベントをインターセプトし、DVCまたはを提示して、DialogViewController追加のユーザー インタラクションを処理します。ここから、それに応じて内容を保存できます。

        private void portriatNavBar ()
        {
            //  _leftButton = new UIBarButtonItem("Calendars", UIBarButtonItemStyle.Bordered, HandlePreviousDayTouch);
            NavigationItem.LeftBarButtonItem = _orgLefButton;
            NavigationItem.Title = "Calendar";
            _rightButton = new UIBarButtonItem (UIBarButtonSystemItem.Add, delegate {
                addController = new EKEventEditViewController ();   
                // set the addController's event store to the current event store.
                addController.EventStore = Util.MyEventStore;
                addController.Event = EKEvent.FromStore(Util.MyEventStore);
                addController.Event.StartDate = DateTime.Now;
                addController.Event.EndDate = DateTime.Now.AddHours(1);

                addController.Completed += delegate(object theSender, EKEventEditEventArgs eva) {
                    switch (eva.Action)
                    {
                        case EKEventEditViewAction.Canceled :
                        case EKEventEditViewAction.Deleted :
                        case EKEventEditViewAction.Saved:
                        this.NavigationController.DismissModalViewControllerAnimated(true);

                        break;
                    }
                };

                // Going to create a precursor to actually displaying the creation of a calendar event so we can grab everything correctly
                RootElement _ctRoot = new RootElement ("Task Details") {
                    new Section () {
                        new RootElement ("Clients") {
                            AppSpecificNamespace.TaskController.GetClientsForCalendar ()
                        },
                        new RootElement ("Task Types") {
                            AppSpecificNamespace.TaskController.GetTypesForCalendar ()
                        }
                    },
                    new Section () {
                        new StyledStringElement ("Continue", delegate {
                            this.NavigationController.PopViewControllerAnimated (true);
                            this.NavigationController.PresentModalViewController (addController, true);
                        }) { Alignment = UITextAlignment.Center, TextColor = UIColor.Blue }
                    }
                };
                DialogViewController AppSpecificDVC = new DialogViewController (_ctRoot);
                this.NavigationController.PushViewController (AppSpecificDVC, true);
                //this.NavigationController.PresentViewController (AppSpecificDVC, true, null);
            });

            NavigationItem.RightBarButtonItem = _rightButton;
        }

これが他の誰かに役立つことを願っています。

于 2013-03-01T00:32:28.527 に答える