Example #1
0
 public ToastMessage(string message, string title, Enums.ToastType toasType, ToastOption options = null)
 {
     this.Message      = message;
     this.Title        = title;
     this.ToastType    = toasType;
     this.ToastOptions = options;
 }
Example #2
0
        public void ShowToast(Enums.ToastType type, string title, string content)
        {
            MessageList.Enqueue(new ToastMessage
            {
                Type    = type,
                Title   = title,
                Content = content
            });

            ShowLastMessage();

            this.ActivateWindow();
        }
Example #3
0
        private void SetStyle(Enums.ToastType type)
        {
            if (type == Enums.ToastType.Warning)
            {
                rect_bg_notify.Visibility = System.Windows.Visibility.Collapsed;
                icon_notify.Visibility    = System.Windows.Visibility.Collapsed;

                rect_bg_warning.Visibility = System.Windows.Visibility.Visible;
                icon_warning.Visibility    = System.Windows.Visibility.Visible;
            }
            else
            {
                rect_bg_warning.Visibility = System.Windows.Visibility.Collapsed;
                icon_warning.Visibility    = System.Windows.Visibility.Collapsed;

                rect_bg_notify.Visibility = System.Windows.Visibility.Visible;
                icon_notify.Visibility    = System.Windows.Visibility.Visible;
            }
        }
Example #4
0
 public void Notify(Enums.ToastType type, string header, string body, Action activated = null, Action <Exception> failed = null)
 {
     Application.Current.Dispatcher.BeginInvoke(new Action(() =>
     {
         try
         {
             InitToastWindow();
             this.ToastWindow.Show();
             this.ToastWindow.WindowState = WindowState.Normal;
             this.ToastWindow.ShowToast(type, header, body);
             this.ToastWindow.ToastClickAction = activated;
         }
         catch (Exception ex)
         {
             AMing.Plugins.Core.GenericMessager.Current.SendToException(ex);
             if (failed != null)
             {
                 failed(ex);
             }
         }
     }));
 }
Example #5
0
        public void AddToastMessage(string title, string message, Enums.ToastType notificationType, ToastOption toastOptions)
        {
            var toastMessage = new ToastMessage(message, title, notificationType, toastOptions);

            AddMessage(toastMessage);
        }