private SlimNotificatorViewModel(NotificationData data) { this._data = data; var screen = NotificationUtil.GetNotifyTargetScreen(); if (screen == null) return; var bound = screen.WorkingArea; if (bound == Rect.Empty) return; // empty data _width = (int)(bound.Width * 0.7); _left = (int)(bound.Left + (bound.Width - this._width) / 2.0); _top = (int)(bound.Bottom - 24); }
private static void Show(NotificationData next) { DispatcherHolder.Enqueue(() => { var mwnd = Application.Current.MainWindow; if (mwnd != null && (Setting.NotifyWhenWindowIsActive.Value || !mwnd.IsActive)) { new SlimNotificatorView { DataContext = new SlimNotificatorViewModel(next) }.Show(); } else { // do not show popup ShowNext(); } }); }