private void OnAdd(Notification notification) { var position = notificationSettings.GetPosition(); var targetMonitor = GetTargetMonitor(); OnAdd(notification, position, targetMonitor); }
public void Show() { var availableMonitors = monitors.AllMonitors().Count(); var monitorIndexes = Enumerable.Range(0, availableMonitors).ToArray(); var monitor = notificationSettings.GetSelectedMonitor(); monitor = monitor < availableMonitors ? monitor : 0; AvailableMonitors = CollectionViewSource.GetDefaultView(monitorIndexes); AvailableMonitors.MoveCurrentTo(monitor); SelectedMonitor = monitor; SelectedPosition = notificationSettings.GetPosition(); Dnd = notificationSettings.GetDnd(); // subcribe to change events after rehydrating // otherwise each property change will recreate samples PropertyChanged += (sender, args) => { var propertyName = args.PropertyName; if (propertyName == "SelectedPosition" || propertyName == "SelectedMonitor" || propertyName == "Dnd") { ClearSamples(); ShowSample(SelectedPosition, SelectedMonitor); } }; ShowSample(SelectedPosition, SelectedMonitor); var onRequestShow = RequestShow; if (onRequestShow != null) { onRequestShow(this, EventArgs.Empty); } }