public void Process(HideNotification message) { if (notifications.ContainsKey(message.NotificationId)) { var notificationViewModelToHide = notifications[message.NotificationId]; CurrentVisibleNotifications.Remove(notificationViewModelToHide); } }
public void Process(ShowNotification message) { var notificationId = Guid.NewGuid(); var notificationViewModel = new NotificationViewModel(message.NotificationMessage, notificationId, viewModelCommunication); if (message.SecondsToShow > 0) { Application.Current.Dispatcher.DelayInvoke( () => viewModelCommunication.Send(new HideNotification(notificationId)), TimeSpan.FromSeconds(message.SecondsToShow) ); } notifications.Add(notificationId, notificationViewModel); CurrentVisibleNotifications.Add(notificationViewModel); }