/// <summary> /// Creates a scheduled toast notification with the required values. /// </summary> /// <param name="content">Text content.</param> /// <param name="title">Toast title.</param> /// <param name="deliveryTime">When to display the toast.</param> /// <returns></returns> public static ScheduledToastNotification CreateScheduledToastNotification(string content, string title, DateTimeOffset deliveryTime) { #if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE_81 XmlDocument doc = Windows.UI.Notifications.ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); var textElements = doc.GetElementsByTagName("text"); textElements[0].InnerText = title; textElements[1].InnerText = content; return new ScheduledToastNotification(new Windows.UI.Notifications.ScheduledToastNotification(doc, deliveryTime)); #elif WINDOWS_PHONE throw new PlatformNotSupportedException(); #elif __ANDROID__ throw new PlatformNotSupportedException(); #elif __IOS__ UILocalNotification localNotification = new UILocalNotification(); localNotification.AlertTitle = title; localNotification.AlertBody = content; localNotification.FireDate = deliveryTime.ToNSDate(); localNotification.SoundName = UILocalNotification.DefaultSoundName; localNotification.RepeatCalendar = global::Foundation.NSCalendar.CurrentCalendar; localNotification.RepeatInterval = global::Foundation.NSCalendarUnit.Minute; return new ScheduledToastNotification(localNotification); #else return new ScheduledToastNotification(content, title, deliveryTime); #endif }