Ejemplo n.º 1
0
        public void ShowToasterNotification(string message, bool extraTime)
        {
            //create on first use
            if (LongToaster == null)
            {
                LongToaster = new Toast.Notifier(cfg =>
                {
                    cfg.PositionProvider       = new ToastP.PrimaryScreenPositionProvider(ToastP.Corner.BottomRight, 10, 10);
                    cfg.LifetimeSupervisor     = new ToastL.TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(120), ToastL.MaximumNotificationCount.FromCount(8));
                    cfg.Dispatcher             = Application.Current.Dispatcher;
                    cfg.DisplayOptions.TopMost = true;
                    cfg.DisplayOptions.Width   = 600;
                });
            }
            if (ShortToaster == null)
            {
                ShortToaster = new Toast.Notifier(cfg =>
                {
                    cfg.PositionProvider       = new ToastP.PrimaryScreenPositionProvider(ToastP.Corner.BottomRight, 10, 10);
                    cfg.LifetimeSupervisor     = new ToastL.TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(12), ToastL.MaximumNotificationCount.FromCount(8));
                    cfg.Dispatcher             = Application.Current.Dispatcher;
                    cfg.DisplayOptions.TopMost = true;
                    cfg.DisplayOptions.Width   = 600;
                });
            }

            message += " (Systematizer)";
            var options = new ToastC.MessageOptions {
                FontSize = 15
            };

            if (extraTime)
            {
                ToastM.InformationExtensions.ShowInformation(LongToaster, message, options);
            }
            else
            {
                ToastM.InformationExtensions.ShowInformation(ShortToaster, message, options);
            }

            SystemSounds.Exclamation.Play();
        }
        protected NotificationBase(string message, MessageOptions options)
        {
            Message = message;

            Options = options ?? new MessageOptions();
        }