/// <summary> /// This method retrieves all the events for the past week via a query and displays them /// on the EventList Screen. /// </summary> protected void GetEventsViaQuery() { // create our NSPredicate which we'll use for the query DateTime startDate = DateTime.Now.AddDays(-7); DateTime endDate = DateTime.Now; // the third parameter is calendars we want to look in, to use all calendars, we pass null NSPredicate query = App.Current.EventStore.PredicateForEvents(startDate, endDate, null); // execute the query EKCalendarItem[] events = App.Current.EventStore.EventsMatching(query); // create a new event list screen with these events and show it eventListScreen = new Calendars.Screens.EventList.EventListController(events, EKEntityType.Event); NavigationController.PushViewController(eventListScreen, true); }
/// <summary> /// This method retrieves all the events for the past week via a query and displays them /// on the EventList Screen. /// </summary> protected void GetRemindersViaQuery() { // create our NSPredicate which we'll use for the query NSPredicate query = App.Current.EventStore.PredicateForReminders(null); // execute the query App.Current.EventStore.FetchReminders( query, (EKReminder[] items) => { // since this is happening in a completion callback, we have to update // on the main thread InvokeOnMainThread(() => { // create a new event list screen with these events and show it eventListScreen = new Calendars.Screens.EventList.EventListController(items, EKEntityType.Reminder); NavigationController.PushViewController(eventListScreen, true); }); }); }
/// <summary> /// This method retrieves all the events for the past week via a query and displays them /// on the EventList Screen. /// </summary> protected void GetRemindersViaQuery () { // create our NSPredicate which we'll use for the query NSPredicate query = App.Current.EventStore.PredicateForReminders (null); // execute the query App.Current.EventStore.FetchReminders ( query, ( EKReminder[] items) => { // since this is happening in a completion callback, we have to update // on the main thread InvokeOnMainThread (() => { // create a new event list screen with these events and show it eventListScreen = new Calendars.Screens.EventList.EventListController (items, EKEntityType.Reminder); NavigationController.PushViewController (eventListScreen, true); }); }); }
/// <summary> /// This method retrieves all the events for the past week via a query and displays them /// on the EventList Screen. /// </summary> protected void GetEventsViaQuery () { // create our NSPredicate which we'll use for the query var startDate = (NSDate)DateTime.Now.AddDays (-7); var endDate = (NSDate)DateTime.Now; // the third parameter is calendars we want to look in, to use all calendars, we pass null NSPredicate query = App.Current.EventStore.PredicateForEvents (startDate, endDate, null); // execute the query EKCalendarItem[] events = App.Current.EventStore.EventsMatching (query); // create a new event list screen with these events and show it eventListScreen = new Calendars.Screens.EventList.EventListController (events, EKEntityType.Event); NavigationController.PushViewController (eventListScreen, true); }