public NotifyIconWindow(INotificationDispatcher notificationDispatcher, IHistoryMenuViewModel historyMenuViewModel) { _notificationDispatcher = notificationDispatcher; _historyMenuViewModel = historyMenuViewModel; InitializeComponent(); HistoryMenu.DataContext = _historyMenuViewModel; _notificationDispatcher.Subscribe(notification => { ShowNotification(notification.Notification); }); }
private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { _historyMenuViewModel = e.NewValue as IHistoryMenuViewModel ?? throw new InvalidOperationException("DataContext must be of type: IHistoryMenuViewModel"); }