public static void ShowSimpleToast(string text) { ToastContent toastContent = new ToastContent { Visual = new ToastVisual { BindingGeneric = new ToastBindingGeneric { Children = { new AdaptiveText { Text = text } } } }, }; ToastNotification toast = new ToastNotification(toastContent.GetXml()); OnChatMessageToastEventArgs args = new OnChatMessageToastEventArgs(toast, null); OnChatMessageToast?.Invoke(args); PopToast(toast, args); }
private static ToastNotification PopToast(ToastContent content) { ToastNotification toast = new ToastNotification(content.GetXml()) { Data = new NotificationData() }; OnChatMessageToastEventArgs args = new OnChatMessageToastEventArgs(toast, null); OnChatMessageToast?.Invoke(args); PopToast(toast, args); return(toast); }
private static void PopToast(ToastContent content, ChatModel chat, string group) { ToastNotification toast = new ToastNotification(content.GetXml()) { Group = group }; OnChatMessageToastEventArgs args = new OnChatMessageToastEventArgs(toast, chat); OnChatMessageToast?.Invoke(args); PopToast(toast, args); }
private static void PopToast(ToastNotification toast, OnChatMessageToastEventArgs args) { switch (args.toasterTypeOverride) { case ChatMessageToasterType.FULL: // Make sure we only send actual on screen popups every 5 seconds: toast.SuppressPopup = DateTime.Now.Subtract(lastPopToast).CompareTo(POP_TOAST_TIMEOUT_TS) < 0; lastPopToast = DateTime.Now; ToastNotificationManager.CreateToastNotifier().Show(toast); Logger.Debug("Toast for group: " + toast.Group + " toasted with toaster type: " + args.toasterTypeOverride.ToString()); break; case ChatMessageToasterType.REDUCED: PopToastReduced(); Logger.Debug("Toast for group: " + toast.Group + " toasted with toaster type: " + args.toasterTypeOverride.ToString()); break; default: Logger.Debug("Toast for group: " + toast.Group + " canceled."); break; } }
public static void ShowAccountMessageToast(string text, string accountBareJid, string tag) { ToastContent toastContent = new ToastContent { Visual = new ToastVisual { BindingGeneric = new ToastBindingGeneric { Children = { new AdaptiveText { Text = text }, new AdaptiveText { Text = accountBareJid, HintStyle = AdaptiveTextStyle.CaptionSubtle } } } }, }; ToastNotification toast = new ToastNotification(toastContent.GetXml()) { Group = ACCOUNT_GROUP_PREFIX + accountBareJid, Tag = tag }; OnChatMessageToastEventArgs args = new OnChatMessageToastEventArgs(toast, null); OnChatMessageToast?.Invoke(args); ToastNotificationManager.History.Remove(tag, ACCOUNT_GROUP_PREFIX + accountBareJid); PopToast(toast, args); }