/// <summary>
        /// Launchs the create new event controller.
        /// </summary>
        protected void LaunchModifyEvent()
        {
            // first we need to create an event it so we have one that we know exists
            // in a real world scenario, we'd likely either a) be modifying an event that
            // we found via a query, or 2) we'd do like this, in which we'd automatically
            // populate the event data, like for say a dr. appt. reminder, or something
            EKEvent newEvent = EKEvent.FromStore(App.Current.EventStore);

            // set the alarm for 10 minutes from now
            newEvent.AddAlarm(EKAlarm.FromDate(DateTime.Now.AddMinutes(10)));
            // make the event start 20 minutes from now and last 30 minutes
            newEvent.StartDate = DateTime.Now.AddMinutes(20);
            newEvent.EndDate   = DateTime.Now.AddMinutes(50);
            newEvent.Title     = "Get outside and do some exercise!";
            newEvent.Notes     = "This is your motivational event to go and do 30 minutes of exercise. Super important. Do this.";

            // create a new EKEventEditViewController. This controller is built in an allows
            // the user to create a new, or edit an existing event.
            MonoTouch.EventKitUI.EKEventEditViewController eventController =
                new MonoTouch.EventKitUI.EKEventEditViewController();

            // set the controller's event store - it needs to know where/how to save the event
            eventController.EventStore = App.Current.EventStore;
            eventController.Event      = newEvent;

            // wire up a delegate to handle events from the controller
            eventControllerDelegate          = new CreateEventEditViewDelegate(eventController);
            eventController.EditViewDelegate = eventControllerDelegate;

            // show the event controller
            PresentViewController(eventController, true, null);
        }
        /// <summary>
        /// Launchs the create new event controller.
        /// </summary>
        protected void LaunchCreateNewEvent()
        {
            // create a new EKEventEditViewController. This controller is built in an allows
            // the user to create a new, or edit an existing event.
            MonoTouch.EventKitUI.EKEventEditViewController eventController =
                new MonoTouch.EventKitUI.EKEventEditViewController();

            // set the controller's event store - it needs to know where/how to save the event
            eventController.EventStore = App.Current.EventStore;

            // wire up a delegate to handle events from the controller
            eventControllerDelegate          = new CreateEventEditViewDelegate(eventController);
            eventController.EditViewDelegate = eventControllerDelegate;

            // show the event controller
            PresentViewController(eventController, true, null);
        }
		/// <summary>
		/// Launchs the create new event controller.
		/// </summary>
		protected void LaunchCreateNewEvent ()
		{
			// create a new EKEventEditViewController. This controller is built in an allows
			// the user to create a new, or edit an existing event.
			MonoTouch.EventKitUI.EKEventEditViewController eventController = 
				new MonoTouch.EventKitUI.EKEventEditViewController ();

			// set the controller's event store - it needs to know where/how to save the event
			eventController.EventStore = App.Current.EventStore;

			// wire up a delegate to handle events from the controller
			eventControllerDelegate = new CreateEventEditViewDelegate ( eventController );
			eventController.EditViewDelegate = eventControllerDelegate;

			// show the event controller
			PresentViewController ( eventController, true, null );
		}
            // completed is called when a user eith
            public override void Completed(MonoTouch.EventKitUI.EKEventEditViewController controller, EKEventEditViewAction action)
            {
                eventController.DismissViewController(true, null);

                // action tells you what the user did in the dialog, so you can optionally
                // do things based on what their action was. additionally, you can get the
                // Event from the controller.Event property, so for instance, you could
                // modify the event and then resave if you'd like.
                switch (action)
                {
                case EKEventEditViewAction.Canceled:
                    break;

                case EKEventEditViewAction.Deleted:
                    break;

                case EKEventEditViewAction.Saved:
                    // if you wanted to modify the event you could do so here, and then
                    // save:
                    //App.Current.EventStore.SaveEvent ( controller.Event, )
                    break;
                }
            }
Example #5
0
 public CreateEventEditViewDelegate(MonoTouch.EventKitUI.EKEventEditViewController eventController)
 {
     // save our controller reference
     this.eventController = eventController;
 }
Example #6
0
        /// <summary>
        /// Launchs the create new event controller.
        /// </summary>
        protected void LaunchModifyEvent()
        {
            // first we need to create an event it so we have one that we know exists
             // in a real world scenario, we'd likely either a) be modifying an event that
             // we found via a query, or 2) we'd do like this, in which we'd automatically
             // populate the event data, like for say a dr. appt. reminder, or something
             EKEvent newEvent = EKEvent.FromStore ( App.Current.EventStore );
             // set the alarm for 10 minutes from now
             newEvent.AddAlarm ( EKAlarm.FromDate ( DateTime.Now.AddMinutes ( 10 ) ) );
             // make the event start 20 minutes from now and last 30 minutes
             newEvent.StartDate = DateTime.Now.AddMinutes ( 20 );
             newEvent.EndDate = DateTime.Now.AddMinutes ( 50 );
             newEvent.Title = "Get outside and do some exercise!";
             newEvent.Notes = "This is your motivational event to go and do 30 minutes of exercise. Super important. Do this.";

             // create a new EKEventEditViewController. This controller is built in an allows
             // the user to create a new, or edit an existing event.
             MonoTouch.EventKitUI.EKEventEditViewController eventController =
            new MonoTouch.EventKitUI.EKEventEditViewController ();

             // set the controller's event store - it needs to know where/how to save the event
             eventController.EventStore = App.Current.EventStore;
             eventController.Event = newEvent;

             // wire up a delegate to handle events from the controller
             eventControllerDelegate = new CreateEventEditViewDelegate ( eventController );
             eventController.EditViewDelegate = eventControllerDelegate;

             // show the event controller
             PresentViewController ( eventController, true, null );
        }
 public CreateEventEditViewDelegate(MonoTouch.EventKitUI.EKEventEditViewController eventController)
 {
     // save our controller reference
     this.eventController = eventController;
 }