Пример #1
0
        public NotifyIconWindow(INotificationDispatcher notificationDispatcher, IHistoryMenuViewModel historyMenuViewModel)
        {
            _notificationDispatcher = notificationDispatcher;
            _historyMenuViewModel   = historyMenuViewModel;

            InitializeComponent();
            HistoryMenu.DataContext = _historyMenuViewModel;

            _notificationDispatcher.Subscribe(notification =>
            {
                ShowNotification(notification.Notification);
            });
        }
Пример #2
0
 private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     _historyMenuViewModel = e.NewValue as IHistoryMenuViewModel ?? throw new InvalidOperationException("DataContext must be of type: IHistoryMenuViewModel");
 }