public override void ScheduleLocalNotification (NotificationData notification, SchedulingData schedule)
{
UIApplication.SharedApplication.InvokeOnMainThread (delegate {
if(notification!=null) {
UILocalNotification localNotification = this.PrepareLocalNotification(notification);
if(schedule != null) {
localNotification.FireDate = IPhoneUtils.DateTimeToNSDate(DateTime.SpecifyKind(schedule.FireDate, DateTimeKind.Local));
SystemLogger.Log(SystemLogger.Module.PLATFORM,"Scheduling local notification at "
+ schedule.FireDate.ToLongTimeString() + ", with a repeat interval of: " + schedule.RepeatInterval);
NSCalendarUnit repeatInterval = 0; // The default value is 0, which means don't repeat.
if(schedule.RepeatInterval.Equals(RepeatInterval.HOURLY)) {
repeatInterval = NSCalendarUnit.Hour;
} else if(schedule.RepeatInterval.Equals(RepeatInterval.DAILY)) {
repeatInterval = NSCalendarUnit.Day;
} else if(schedule.RepeatInterval.Equals(RepeatInterval.WEEKLY)) {
repeatInterval = NSCalendarUnit.Week;
} else if(schedule.RepeatInterval.Equals(RepeatInterval.MONTHLY)) {
repeatInterval = NSCalendarUnit.Month;
} else if(schedule.RepeatInterval.Equals(RepeatInterval.YEARLY)) {
repeatInterval = NSCalendarUnit.Year;
}
localNotification.RepeatInterval = repeatInterval;
UIApplication.SharedApplication.ScheduleLocalNotification(localNotification);
SystemLogger.Log(SystemLogger.Module.PLATFORM, "Local Notification scheduled successfully [" + localNotification.FireDate.ToString() +"]");
SystemLogger.Log(SystemLogger.Module.PLATFORM, "Current scheduled #num of local notifications: " + this.GetCurrentScheduledLocalNotifications());
} else {
SystemLogger.Log(SystemLogger.Module.PLATFORM,"No suitable scheduling data object received for scheduling this local notification");
}
} else {
SystemLogger.Log(SystemLogger.Module.PLATFORM,"No suitable data object received for presenting local notification");
}
});
}