void Toast_Dismissed(global::Windows.UI.Notifications.ToastNotification sender, global::Windows.UI.Notifications.ToastDismissedEventArgs args) { if (ToastDismissed != null) { ToastDismissed.Invoke(sender, args); } }
void Toast_Activated(global::Windows.UI.Notifications.ToastNotification sender, object args) { if (ToastActivated != null) { ToastActivated.Invoke(sender, args as global::Windows.UI.Notifications.ToastActivatedEventArgs); } }
public void ShowToast(string title, string content, ToastAuidoType auidoType, uint delayInSecond, uint repeat, uint repeatInterval, string token, string id) { if (repeat > 5) { throw new ArgumentOutOfRangeException("repeat", repeat, "Should Be Less Than 5"); } if (!string.IsNullOrEmpty(id) && id.Length > 15) { throw new ArgumentOutOfRangeException("id", id, "Should Be Less Than 15 Characters"); } var toastDOM = new ToastNotificationContent(title, content, auidoType).GetXmlDocument(); if (!string.IsNullOrEmpty(token)) { var toastNode = toastDOM.SelectSingleNode("/toast"); if (toastNode != null) { var element = toastDOM.CreateElement(EXTRANODENAME); element.SetAttribute(TOKENATTRIBUTENAME, token); toastNode.AppendChild(element); } } try { if (delayInSecond == 0) { var toast = new global::Windows.UI.Notifications.ToastNotification(toastDOM); toast.Activated += Toast_Activated; toast.Dismissed += Toast_Dismissed; toast.Failed += Toast_Failed; ToastNotifier.Show(toast); } else { var dueTime = DateTimeOffset.Now.AddSeconds(delayInSecond); global::Windows.UI.Notifications.ScheduledToastNotification toast = repeat > 0 ? new global::Windows.UI.Notifications.ScheduledToastNotification(toastDOM, dueTime, TimeSpan.FromSeconds(Math.Min(3600, Math.Max(60, repeatInterval))), repeat) : new global::Windows.UI.Notifications.ScheduledToastNotification(toastDOM, dueTime); if (!string.IsNullOrEmpty(id)) { toast.Id = id; } ToastNotifier.AddToSchedule(toast); } } catch (Exception) { throw; } }
public void Hide(global::Windows.UI.Notifications.ToastNotification notification) { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.Notifications.ToastNotifier", "void ToastNotifier.Hide(ToastNotification notification)"); }
public string GetToken(global::Windows.UI.Notifications.ToastNotification notification) { return(GetToken(notification.Content)); }