Exemple #1
0
        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);
        }
Exemple #2
0
        private static void popToast(ToastContent content, ChatTable chat, string group)
        {
            ToastNotification toast = new ToastNotification(content.GetXml())
            {
                Group = group
            };

            OnChatMessageToastEventArgs args = new OnChatMessageToastEventArgs(toast, chat);

            OnChatMessageToast?.Invoke(args);

            popToast(toast, args);
        }
Exemple #3
0
        private static void popToast(ToastNotification toast, OnChatMessageToastEventArgs args)
        {
            switch (args.toasterTypeOverride)
            {
            case ChatMessageToasterType.FULL:
                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;
            }
        }
Exemple #4
0
        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;
            }
        }