Ejemplo n.º 1
0
        partial void showCalendarChooser(UIKit.UIBarButtonItem sender)
        {
            // Show the EKCalendarChooser
            var calendarChooser = new EKCalendarChooser(EKCalendarChooserSelectionStyle.Single,
                                                        EKCalendarChooserDisplayStyle.WritableCalendarsOnly,
                                                        model.EventStore);

            calendarChooser.ShowsDoneButton   = true;
            calendarChooser.ShowsCancelButton = false;
            calendarChooser.SelectionChanged += (object obj, EventArgs e) =>
            {
                // Called whenever the selection is changed by the user
                model.SelectedCalendar = (EKCalendar)calendarChooser.SelectedCalendars.AnyObject;
                Title = model.SelectedCalendar.Title;
            };
            calendarChooser.Finished += (object obj, EventArgs e) =>
            {
                // These are called when the corresponding button is pressed to dismiss the
                // controller. It is up to the recipient to dismiss the chooser.
                model.FetchPokerEvents();
                DismissViewController(true, null);
            };
            calendarChooser.SelectionChanged += (object obj, EventArgs e) =>
            {
                // Update our events, since the selected calendar may have changed.
                model.SelectedCalendar = (EKCalendar)calendarChooser.SelectedCalendars.AnyObject;
                Title = model.SelectedCalendar.Title;
            };

            if (model.SelectedCalendar != null)
            {
                EKCalendar[] temp = new EKCalendar [1];
                temp [0] = model.SelectedCalendar;
                var selectedCalendars = new NSSet(temp);
                calendarChooser.SelectedCalendars = selectedCalendars;
            }

            UINavigationController navigationController = new UINavigationController(calendarChooser);

            PresentViewController(navigationController, true, null);
        }
		partial void showCalendarChooser (MonoTouch.UIKit.UIBarButtonItem sender)
		{
			// Show the EKCalendarChooser
			var calendarChooser = new EKCalendarChooser (EKCalendarChooserSelectionStyle.Single, 
			                                                           EKCalendarChooserDisplayStyle.WritableCalendarsOnly,
			                                                           model.EventStore);
			calendarChooser.ShowsDoneButton = true;
			calendarChooser.ShowsCancelButton = false;
			calendarChooser.SelectionChanged += (object obj, EventArgs e) => 
			{
				// Called whenever the selection is changed by the user
				model.SelectedCalendar = (EKCalendar) calendarChooser.SelectedCalendars.AnyObject;
				Title = model.SelectedCalendar.Title;
			};
			calendarChooser.Finished += (object obj, EventArgs e) => 
			{
				// These are called when the corresponding button is pressed to dismiss the
				// controller. It is up to the recipient to dismiss the chooser.
				model.FetchPokerEvents ();
				DismissViewController (true, null);
			};
			calendarChooser.SelectionChanged += (object obj, EventArgs e) => 
			{
				// Update our events, since the selected calendar may have changed.
				model.SelectedCalendar = (EKCalendar) calendarChooser.SelectedCalendars.AnyObject;
				Title = model.SelectedCalendar.Title;
			};

			if (model.SelectedCalendar != null) {
				EKCalendar[] temp = new EKCalendar [1];
				temp [0] = model.SelectedCalendar;
				var selectedCalendars = new NSSet (temp);
				calendarChooser.SelectedCalendars = selectedCalendars;
			}

			UINavigationController navigationController = new UINavigationController (calendarChooser);
			PresentViewController (navigationController, true, null);
		}