public MainWindowViewModel() { CompositeDisposable.Add(_backstageViewModel = new BackstageViewModel()); CompositeDisposable.Add(this._inputViewModel = new InputViewModel()); CompositeDisposable.Add(_mainAreaViewModel = new MainAreaViewModel()); CompositeDisposable.Add(_globalAccountSelectionFlipViewModel = new AccountSelectionFlipViewModel()); CompositeDisposable.Add(_settingFlipViewModel = new SettingFlipViewModel(this)); CompositeDisposable.Add(_tabConfigurationFlipViewModel = new TabConfigurationFlipViewModel()); CompositeDisposable.Add(_searchFlipViewModel = new SearchFlipViewModel()); CompositeDisposable.Add(Observable .FromEvent <FocusRequest>( h => MainWindowModel.FocusRequested += h, h => MainWindowModel.FocusRequested -= h) .Subscribe(SetFocus)); CompositeDisposable.Add(Observable .FromEvent <bool>( h => MainWindowModel.BackstageTransitionRequested += h, h => MainWindowModel.BackstageTransitionRequested -= h) .Subscribe(this.TransitionBackstage)); CompositeDisposable.Add(Setting.BackgroundImagePath.ListenValueChanged( _ => { RaisePropertyChanged(() => BackgroundImageUri); RaisePropertyChanged(() => BackgroundImage); })); CompositeDisposable.Add(Setting.BackgroundImageTransparency.ListenValueChanged( _ => RaisePropertyChanged(() => BackgroundImageOpacity))); CompositeDisposable.Add(Setting.RotateWindowContent.ListenValueChanged( _ => RaisePropertyChanged(() => RotateWindowContent))); this._backstageViewModel.Initialize(); }
public ColumnViewModel(MainAreaViewModel parent, ColumnModel model) { _parent = parent; _model = model; this.CompositeDisposable.Add( _tabs = ViewModelHelper.CreateReadOnlyDispatcherCollection( model.Tabs, _ => new TabViewModel(this, _), DispatcherHelper.UIDispatcher)); this.CompositeDisposable.Add( Observable.FromEvent( h => _model.OnCurrentFocusColumnChanged += h, h => _model.OnCurrentFocusColumnChanged -= h) .Select(_ => _model.CurrentFocusTabIndex) .Subscribe(UpdateFocusFromModel)); if (_tabs.Count > 0) { Focused = _tabs[0]; } }
public ColumnViewModel(MainAreaViewModel parent, ColumnModel model) { this._parent = parent; this._model = model; this.CompositeDisposable.Add( this._tabs = ViewModelHelperRx.CreateReadOnlyDispatcherCollectionRx( model.Tabs, _ => new TabViewModel(this, _), DispatcherHelper.UIDispatcher)); this.CompositeDisposable.Add( Observable.FromEvent( h => this._model.CurrentFocusTabChanged += h, h => this._model.CurrentFocusTabChanged -= h) .Select(_ => this._model.CurrentFocusTabIndex) .Subscribe(this.UpdateFocusFromModel)); this.CompositeDisposable.Add(_tabs.ListenCollectionChanged(_ => this._tabs.ForEach(item => item.UpdateFocus()))); if (this._tabs.Count > 0) { this.FocusedTab = this._tabs[0]; } }