public async static void Show(string message, string title, Brush backgroundBrush, Brush foregroundTextBrush, Brush countdownBackgroundBrush, double timeToLive, bool autoHide = false, double width = 300, double height = 180, string metroIcon = "", string imageIcon = "", double scaleIcon = 1)
        {
            if (NotificationService._rootControl != null && message != null)
            {
                DispatchedHandler invokedHandler = new DispatchedHandler(() =>
                {
                    if (NotificationService._rootControl == null) //|| MsgBoxService._rootControl.Visibility == Visibility.Visible)
                    {
                        return;
                    }
                    NotificationService._rootControl.Visibility = Visibility.Visible;
                    NotificationView view = new NotificationView(message, "", autoHide, timeToLive, metroIcon, iconColor: backgroundBrush, imageIcon: imageIcon, scaleIcon: scaleIcon);
                    view.Width            = width;
                    view.Height           = height;
                    view.Margin           = new Thickness(3);
                    //view.HorizontalAlignment = horizontalAlignment;
                    //view.VerticalAlignment = VerticalAlignment.Top;
                    view.BackgroundFill             = backgroundBrush;
                    view.MessageTextForegroundColor = foregroundTextBrush;
                    view.CountdownBackgroundColor   = countdownBackgroundBrush;
                    view.Show();
                    view.OnClosing += new EventHandler(NotificationService.view_OnClosing);

                    NotificationService._MsgboxContainer.Children.Insert(0, view);
                });
                await NotificationService._rootControl.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, invokedHandler);
            }
        }
        public void CreateNotification(ICollection <Inline> title, ICollection <Inline> message, Color color, TimeSpan showTime)
        {
            var notification = new NotificationView(new NotificationViewModel()
            {
                Title    = title,
                Message  = message,
                BarBrush = App.GetBrush(color),
            });

            notifications.Add(notification);

            notification.Show();
            PlaceNotification(notification);

            var timer = new Timer(showTime.TotalMilliseconds);

            timer.Elapsed += (sender, e) =>
            {
                timer.Stop();
                timer.Dispose();
                timers.Remove(timer);

                notification.Dispatcher.BeginInvoke(new Action(() =>
                {
                    notification.Close();
                    notifications.Remove(notification);
                }));
            };
            timers.Add(timer);
            timer.Start();
        }
 public void ShowOnNotifiaction()
 {
     try
     {
         if (!NotificationView.IsVisible)
         {
             if (BuyNotifications.Count > 0)
             {
                 double x = SystemParameters.PrimaryScreenWidth - NotificationView.Width;
                 double y = SystemParameters.PrimaryScreenHeight - NotificationView.Height - 40;
                 NotificationView.Left = x;
                 NotificationView.Top  = y;
                 NotificationView.Activate();
                 NotificationView.Topmost = HotItemController.Config.IsTopMostNotification;  // important
                 if (HotItemController.Config.IsTopMostNotification)
                 {
                     NotificationView.Show();
                 }
             }
         }
         else
         {
             //NotificationView.Hide();
         }
     }
     catch { }
 }
示例#4
0
        /// <summary>The on startup.</summary>
        /// <param name="e">The e.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            this.InitializeErrorHandler();
            NotificationView.Initialize();
            var result = new QueueHandler(e.Args).Process();

            string message = null;

            if (result == Status.Success)
            {
                message = Literals.ShellExtension_Subtitles_downloaded_successfully;
            }
            else if (result == Status.Fatal)
            {
                message = Literals.ShellExtension_Failed_process_request;
            }

            if (string.IsNullOrEmpty(message))
            {
                NotificationView.AttachEndHandler((sender, args) => this.Dispatcher.InvokeShutdown());
            }
            else
            {
                NotificationView.Show(message, (sender, args) => this.Dispatcher.InvokeShutdown());
            }
        }
示例#5
0
 private void OnLogEvent(object Sender, LogEventArgs args)
 {
     if (args.EntryClass.EventType == LogEventType.Error || args.EntryClass.EventType == LogEventType.Event)
     {
         LogCollectionManager.LogEvents.Add(args.EntryClass);
         var message = args.EntryClass.LogEntry;
         var form    = new NotificationView(message);
         form.Show();
     }
 }
示例#6
0
 public void SetNotificationShown(bool shown)
 {
     if (notification.Shown != shown)
     {
         if (!notification.Shown)
         {
             notification.Show();
         }
         else
         {
             notification.Hide();
         }
     }
 }
示例#7
0
        public void SetNotificationShown(bool shown)
        {
            if (notification.Shown != shown)
            {
                if (!notification.Shown)
                {
                    notification.Show();
                }
                else
                {
                    notification.Hide();
                }
            }

            background.color = shown ? config.DefaultColor : config.LockedColor;
        }