protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var mainWindowState = new MainWindowState(); new MainWindow { DataContext = new MainWindowViewModel(mainWindowState) }.Show(); }
public MainWindowViewModel(MainWindowState state) { _state = state; var stateListener = new PropertyChangedEventListener(_state); stateListener.RegisterHandler(nameof(_state.Mode), (_, __) => RaisePropertyChanged(nameof(Mode))); CompositeDisposable.Add(stateListener); UserScreenCommand = new ViewModelCommand(() => _state.Mode = MainWindowMode.User); ProductScreenCommand = new ViewModelCommand(() => _state.Mode = MainWindowMode.Product); }