/// <summary>
        /// Pops the toast execute.
        /// </summary>
        public void PopToastExecute(object param)
        {
            Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(
                                                      () =>
            {
                var background = new LinearGradientBrush(this.StartColor, this.EndColor, 90);
                var brush      = new SolidColorBrush(this.BorderColor);
                var font       = new SolidColorBrush(this.fontColor);

                var notificationType = (NotificationType)Enum.Parse(typeof(NotificationType), this.SelectedNotificationType.Value.ToString());
                ToastPopUp toast;
                switch (param.ToString())
                {
                case "1":
                    toast                   = new ToastPopUp(this.Title, this.Text, this.HyperlinkText, notificationType);
                    toast.Background        = background;
                    toast.BorderBrush       = brush;
                    toast.FontColor         = font;
                    toast.HyperlinkClicked += this.ToastHyperlinkClicked;
                    toast.ClosedByUser     += this.ToastClosedByUser;
                    toast.Show();

                    break;

                case "2":
                    toast                   = new ToastPopUp(this.Title, this.Text, this.HyperlinkText, Properties.Resources.disk_blue);
                    toast.Background        = background;
                    toast.BorderBrush       = brush;
                    toast.FontColor         = font;
                    toast.HyperlinkClicked += this.ToastHyperlinkClicked;
                    toast.ClosedByUser     += this.ToastClosedByUser;
                    toast.Show();

                    break;

                case "3":
                    var inlines = new List <Inline>();
                    inlines.Add(new Run {
                        Text = this.Text
                    });
                    inlines.Add(new Run {
                        Text = Environment.NewLine
                    });
                    inlines.Add(new Run("This text will be italic.")
                    {
                        FontStyle = FontStyles.Italic
                    });

                    toast                   = new ToastPopUp(this.Title, inlines, this.HyperlinkText, notificationType);
                    toast.Background        = background;
                    toast.BorderBrush       = brush;
                    toast.FontColor         = font;
                    toast.HyperlinkClicked += this.ToastHyperlinkClicked;
                    toast.ClosedByUser     += this.ToastClosedByUser;
                    toast.Show();

                    break;
                }
            }));
        }
        public ToastPopUp CreateToast(ToastType toastType)
        {
            var background = new LinearGradientBrush(this.StartColor, this.EndColor, 90);
            var brush      = new SolidColorBrush(this.BorderColor);
            var font       = new SolidColorBrush(this.fontColor);

            NotificationType notificationType = (NotificationType)Enum.Parse(typeof(NotificationType), this.SelectedNotificationType.Value.ToString());
            ToastPopUp       toast            = null;

            switch (toastType)
            {
            case ToastType.Basic:
                toast                   = new ToastPopUp(this.Title, this.Text, this.HyperlinkText, notificationType);
                toast.Background        = background;
                toast.BorderBrush       = brush;
                toast.FontColor         = font;
                toast.HyperlinkClicked += this.ToastHyperlinkClicked;
                toast.ClosedByUser     += this.ToastClosedByUser;

                break;

            case ToastType.Image:
                toast                   = new ToastPopUp(this.Title, this.Text, this.HyperlinkText, Properties.Resources.disk_blue);
                toast.Background        = background;
                toast.BorderBrush       = brush;
                toast.FontColor         = font;
                toast.HyperlinkClicked += this.ToastHyperlinkClicked;
                toast.ClosedByUser     += this.ToastClosedByUser;

                break;

            case ToastType.Inlines:
                var inlines = new List <Inline>();
                inlines.Add(new Run
                {
                    Text = this.Text
                });
                inlines.Add(new Run
                {
                    Text = Environment.NewLine
                });
                inlines.Add(new Run("This text will be italic.")
                {
                    FontStyle = FontStyles.Italic
                });

                toast                   = new ToastPopUp(this.Title, inlines, this.HyperlinkText, notificationType);
                toast.Background        = background;
                toast.BorderBrush       = brush;
                toast.FontColor         = font;
                toast.HyperlinkClicked += this.ToastHyperlinkClicked;
                toast.ClosedByUser     += this.ToastClosedByUser;

                break;
            }

            return(toast);
        }
Example #3
0
        private static void OnSucceed(SucceedMsg msg)
        {
            var toast = new ToastPopUp(
                "Info",
                msg.ToString(),
                NotificationType.Information);

            toast.Show();
        }
Example #4
0
        private void ShowPopup(string title, string message, NotificationType type)
        {
            var popup = new ToastPopUp(title, message, type)
            {
                Background = Background,
                FontFamily = FontFamily
            };

            popup.Show();
        }
        private void ShowPopup(string title, string message, NotificationType type)
        {
            var popup = new ToastPopUp(title, message, type)
            {
                Background = Background,
                FontColor = Brushes.Bisque,
                FontFamily = FontFamily
            };

            popup.Show();
        }
 /// <summary>
 /// Pops the toast execute.
 /// </summary>
 public void PopToastExecute()
 {
     App.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(
                                       () =>
     {
         NotificationType notificationType = (NotificationType)System.Enum.Parse(typeof(NotificationType), this.SelectedNotificationType.Value.ToString());
         var toast = new ToastPopUp(this.Title, this.Text, this.HyperlinkText, notificationType);
         toast.HyperlinkClicked += this.ToastHyperlinkClicked;
         toast.ClosedByUser     += this.ToastClosedByUser;
         toast.Show();
     }));
 }
Example #7
0
        public void GoNotification(string title, string text, NotificationType nType)
        {
            // This example shows how to register the available events var toast = new ToastPopUp( "My Title", "This is the main content.", "Click this Hyperlink", NotificationType.Information);

            // This is what will be passed back through the HyperlinkClicked event. toast.HyperlinkObjectForRaisedEvent = new object(); toast.HyperlinkClicked += this.ToastHyperlinkClicked; toast.ClosedByUser += this.ToastClosedByUser; toast.Show();

            // Passing rich text as inlines and overrides the image. var inlines = new List(); inlines.Add(new Run() { Text = "This is the first line of my main content." }); inlines.Add(new Run() { Text = Environment.NewLine }); inlines.Add(new Run("This text will be italic.") { FontStyle = FontStyles.Italic });

            var toast = new ToastPopUp(title, text, nType);

            toast.Show();
            // If you don't need any events fired, you can do this. new ToastPopUp("My Title", "This is the main content.", NotificationType.Information) { Background = new LinearGradientBrush(Color.FromArgb(255, 4, 253, 82), Color.FromArgb(255, 10, 13, 248), 90), BorderBrush = new SolidColorBrush(Color.FromRgb(0, 0, 0)), FontColor = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)) }.Show();
        }
        /// <summary>
        /// Pops the toast execute.
        /// </summary>
        public void PopToastExecute(object param)
        {
            App.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(
                                              () =>
            {
                NotificationType notificationType = (NotificationType)System.Enum.Parse(typeof(NotificationType), this.SelectedNotificationType.Value.ToString());
                ToastPopUp toast;
                switch (param.ToString())
                {
                case "1":
                    toast = new ToastPopUp(this.Title, this.Text, this.HyperlinkText, notificationType);
                    toast.HyperlinkClicked += this.ToastHyperlinkClicked;
                    toast.ClosedByUser     += this.ToastClosedByUser;
                    toast.Show();

                    break;

                case "2":
                    toast = new ToastPopUp(this.Title, this.Text, this.HyperlinkText, DemoApplication.Properties.Resources.disk_blue);
                    toast.HyperlinkClicked += this.ToastHyperlinkClicked;
                    toast.ClosedByUser     += this.ToastClosedByUser;
                    toast.Show();

                    break;

                case "3":
                    var inlines = new List <Inline>();
                    inlines.Add(new Run()
                    {
                        Text = this.Text
                    });
                    inlines.Add(new Run()
                    {
                        Text = Environment.NewLine
                    });
                    inlines.Add(new Run("This text will be italic.")
                    {
                        FontStyle = FontStyles.Italic
                    });

                    toast = new ToastPopUp(this.Title, inlines, this.HyperlinkText, notificationType);
                    toast.HyperlinkClicked += this.ToastHyperlinkClicked;
                    toast.ClosedByUser     += this.ToastClosedByUser;
                    toast.Show();

                    break;
                }
            }));
        }
Example #9
0
        private void ShowPopup(string title, string message, NotificationType type)
        {
            this.InvokeIfRequired(() =>
            {
                var popup = new ToastPopUp(title, message, type)
                {
                    Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x1B, 0x1B, 0x1B)),
                    FontColor  = Brushes.Bisque,
                    FontFamily = FontFamily
                };

                popup.Show();
            },
                                  DispatcherPriority.Normal);
        }
Example #10
0
        private void ViewModelOnBattleOccured(object sender, BattleEventArgs e)
        {
            var notification = string.Format("Result:            {0}\n", e.Battle.Stars > 0 ? "DEFEAT" : "VICTORY") +
                               string.Format("Damage %:    {0}\n", e.Battle.BaseDamagePercent) +
                               string.Format("Stars scored:  {0}\n", e.Battle.Stars) +
                               string.Format("SC units left:  {0}", e.ScUnitsCountRemaining);

            Application.Current.Dispatcher.Invoke(() =>
            {
                var toast = new ToastPopUp("Defensive battle completed!", notification,
                                           NotificationType.Information)
                {
                    Background  = new LinearGradientBrush(Color.FromRgb(193, 237, 230), Color.FromRgb(128, 148, 255), 90),
                    BorderBrush = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                    FontColor   = new SolidColorBrush(Color.FromArgb(255, 32, 32, 32)),
                };
                toast.MouseDoubleClick += delegate
                {
                    Show();
                    WindowState = WindowState.Normal;
                };
                toast.Show();
            });
        }
Example #11
0
        private void ButtonPopToastNotificationCenterClick(object sender, RoutedEventArgs e)
        {
            ToastPopUp toast = this.viewModel.CreateToast(ToastType.Basic);

            this.NotificationCenter.Add(toast);
        }
Example #12
0
        private void ShowPopup(string title, string message, NotificationType type)
        {
            this.InvokeIfRequired(() =>
            {
                var popup = new ToastPopUp(title, message, type)
                {
                    Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x1B, 0x1B, 0x1B)),
                    FontColor = Brushes.Bisque,
                    FontFamily = FontFamily
                };

                popup.Show();
            },
                DispatcherPriority.Normal);
        }