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();
        }
예제 #2
0
        private void Show(INotification aNotification)
        {
            if (iNotificationView != null)
            {
                iNotificationView.Close();
            }
            if (iOptionsDialog != null)
            {
                iOptionsDialog.Close();
            }
            var notificationView = new NotificationView();

            notificationView.Closed += (s, e) =>
            {
                iNotificationView = null;
            };
            notificationView.Launch(aNotification, this);
            iNotificationView = notificationView;
        }
 void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     NotificationView.Close();
 }