public PlayShellView(IEventAggregator eventBus, UserSettings settings, INotificationCenterMessageHandler handler, IDialogManager dialogManager, IExceptionHandler exceptionHandler) { InitializeComponent(); Loaded += (sender, args) => DialogHelper.MainWindowLoaded = true; _userSettings = settings; _handler = handler; _dialogManager = dialogManager; _exceptionHandler = exceptionHandler; _snow = new Snow(ContentCanvas, eventBus); WorkaroundSystemMenu_Init(); this.WhenActivated(d => { d(UserError.RegisterHandler<CanceledUserError>(x => CanceledHandler(x))); d(UserError.RegisterHandler<NotLoggedInUserError>(x => NotLoggedInDialog(x))); d(UserError.RegisterHandler<NotConnectedUserError>(x => NotConnectedDialog(x))); d(UserError.RegisterHandler<BusyUserError>(x => BusyDialog(x))); d(this.WhenAnyValue(x => x.ViewModel).BindTo(this, v => v.DataContext)); d(this.OneWayBind(ViewModel, vm => vm.Overlay.ActiveItem, v => v.MainScreenFlyout.ViewModel)); d(this.OneWayBind(ViewModel, vm => vm.SubOverlay, v => v.SubscreenFlyout.ViewModel)); d(this.OneWayBind(ViewModel, vm => vm.StatusFlyout, v => v.StatusFlyout.ViewModel)); d(this.WhenAnyObservable(x => x.ViewModel.ActivateWindows) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => DialogHelper.ActivateWindows(x))); d(_userSettings.AppOptions.WhenAnyValue(x => x.DisableEasterEggs) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(HandleEasterEgg)); d(TryCreateTrayIcon()); }); ThemeManager.IsThemeChanged += CustomThemeManager.ThemeManagerOnIsThemeChanged; }
public PlayShellView(IEventAggregator eventBus, UserSettings settings, INotificationCenterMessageHandler handler, IDialogManager dialogManager, IExceptionHandler exceptionHandler, ISpecialDialogManager specialDialogManager) { InitializeComponent(); Loaded += OnRoutedEventHandler; _userSettings = settings; _handler = handler; _dialogManager = dialogManager; _exceptionHandler = exceptionHandler; _specialDialogManager = specialDialogManager; WorkaroundSystemMenu_Init(); this.WhenActivated(d => { // TODO //d(UserError.RegisterHandler<CanceledUserError>(x => CanceledHandler(x))); //d(UserError.RegisterHandler<NotLoggedInUserError>(x => NotLoggedInDialog(x))); //d(UserError.RegisterHandler<NotConnectedUserError>(x => NotConnectedDialog(x))); //d(UserError.RegisterHandler<BusyUserError>(x => BusyDialog(x))); d(this.WhenAnyValue(x => x.ViewModel).BindTo(this, v => v.DataContext)); d(this.OneWayBind(ViewModel, vm => vm.Overlay.ActiveItem, v => v.MainScreenFlyout.ViewModel)); d(this.OneWayBind(ViewModel, vm => vm.SubOverlay, v => v.SubscreenFlyout.ViewModel)); d(this.OneWayBind(ViewModel, vm => vm.StatusFlyout, v => v.StatusFlyout.ViewModel)); d(this.WhenAnyObservable(x => x.ViewModel.ActivateWindows) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => DialogHelper.ActivateWindows(x))); d(TryCreateTrayIcon()); }); ThemeManager.IsThemeChanged += CustomThemeManager.ThemeManagerOnIsThemeChanged; }
public NotificationsCenterViewModel(Lazy <IPlayShellViewModel> shellVm, IMediator mediator, INotificationCenterMessageHandler handler) { _shellVm = shellVm; _mediator = mediator; this.SetCommand(x => x.Open); Open.Subscribe(x => IsOpen = !IsOpen); this.SetCommand(x => x.ClearNotifications); ReactiveUI.ReactiveCommand.CreateAsyncTask(x => { var notification = (NotificationBaseDataModel)x; return(ExecuteNotificationCommand(notification)); }) .SetNewCommand(this, x => x.ExecuteCommand) .Subscribe(x => HandleSubscription((dynamic)x)); ClearNotifications.Subscribe(x => { lock (Notifications) { var notifications = Notifications.Where(y => y.OneTimeAction).ToReadOnlyClonedCollection(); Notifications.RemoveAll(notifications); } }); Notifications = new ReactiveList <NotificationBaseDataModel>(); Notifications.EnableCollectionSynchronization(_notificationsLock); handler.NotificationCenter.Subscribe(x => HandleNotification((dynamic)x)); }