/// <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 = AppDelegate.EventStore.PredicateForReminders (null); // execute the query AppDelegate.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 EventListDVC (items, EKEntityType.Reminder); //NavigationController.PushViewController (eventListScreen, true); PresentViewController(eventListScreen, true,null); }); }); }
/// <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 = AppDelegate.EventStore.PredicateForEvents (startDate, endDate, null); // execute the query EKCalendarItem[] events = AppDelegate.EventStore.EventsMatching (query); // create a new event list screen with these events and show it eventListScreen = new EventListDVC (events, EKEntityType.Event); //NavigationController.PushViewController (eventListScreen, true); PresentViewController(eventListScreen, true,null); }