public async static Task<bool> Notification(string nameContent, string nameDetail, string img) { ToastNotification toastNotification; var notificationXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText03); var toeastElement = notificationXml.GetElementsByTagName("text"); toeastElement[0].AppendChild(notificationXml.CreateTextNode(nameContent)); toeastElement[1].AppendChild(notificationXml.CreateTextNode(nameDetail)); var imageElement = notificationXml.GetElementsByTagName("image"); imageElement[0].Attributes[1].NodeValue = img; toastNotification = new ToastNotification(notificationXml); ToastNotificationManager.CreateToastNotifier().Show(toastNotification); toastNotification.Dismissed += toast_Dismissed; toastNotification.Failed += toast_Failed; toastNotification.Activated += toast_click; return true; }
await FunctionSQLite.Notification(not_name, not_cate, not_img);
private static void toast_click(ToastNotification sender, object args) { Debug.WriteLine("Event Click: click"); // throw new NotImplementedException(); } private static void toast_Failed(ToastNotification sender, ToastFailedEventArgs args) { Debug.WriteLine("Event Click: error"); // throw new NotImplementedException(); } private static void toast_Dismissed(ToastNotification sender, ToastDismissedEventArgs e) { if (e.Reason == ToastDismissalReason.UserCanceled) { Debug.WriteLine("Event Click: cancel"); } else if (e.Reason == ToastDismissalReason.TimedOut) { Debug.WriteLine("Event Click: Timedout"); } else if (e.Reason == ToastDismissalReason.ApplicationHidden) { Debug.WriteLine("Event Click: ApplicationHidden"); } }