Control mbGetCalendars Inherits MobileButton
ControlInstance mbGetCalendars Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
dim calendars() as EKCalendarMBS
dim msgBox as New MobileMessageBox
if not EventKit.bEventPermissionGranted = True then
msgBox.Title = "You must give the app access to calendar events to be able to get the calendars on this device."
msgBox.Show
Return
end if
calendars = EventKit.EventStore.calendarsForEntityType( EKEventStoreMBS.kEntityTypeEvent )
msgBox.Title = calendars.LastIndex.ToString + " calendars found"
msgBox.Buttons = Array( "OK" )
msgBox.Show
End EventHandler
End Control
Control mbGetEvents Inherits MobileButton
ControlInstance mbGetEvents Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
dim msgBox as New MobileMessageBox
dim iCalEvents() as EKEventMBS
dim thePredicate as NSPredicateMBS
dim dateStart, dateEnd as DateTime
dim theInterval as DateInterval
if not EventKit.bEventPermissionGranted = True then
msgBox.Title = "You must give the app access to calendar events to be able to get the events on this device."
msgBox.Show
Return
end if
dateStart = New DateTime( DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0, 0, TimeZone.Current )
theInterval = New DateInterval( 0, 1, 0, 0, 0, -1 )
dateEnd = dateStart + theInterval
// Have to ask for events finishing the day after the one we're after or all-day events on the last day don't get included
thePredicate = EventKit.EventStore.predicateForEvents( dateStart, dateEnd )
iCalEvents = EventKit.EventStore.eventsMatchingPredicate( thePredicate )
msgBox.Title = iCalEvents.LastIndex.ToString + " events found for this month"
msgBox.Buttons = Array( "OK" )
msgBox.Show
End EventHandler
End Control