public AppListViewModel(IAppViewModelFactory appViewModelFactory, IAppService appService) { this.appViewModelFactory = appViewModelFactory ?? throw new ArgumentNullException(nameof(appViewModelFactory)); this.appService = appService ?? throw new ArgumentNullException(nameof(appService)); Initialize(); }
public DocumentViewModel(IViewAdapter viewAdapter, IAppViewModelFactory viewModelFactory) : base(viewAdapter) { this._viewModelFactory = viewModelFactory ?? throw new ArgumentNullException(nameof(viewModelFactory)); this.SaveCommand = new RelayCommand(this.Save, this.CanSave); this.Title = "unnamed"; }
public MainViewModel(IViewAdapter viewAdapter, IAppViewModelFactory viewModelFactory) : base(viewAdapter) { this._viewModelFactory = viewModelFactory ?? throw new ArgumentNullException(nameof(viewModelFactory)); this.Title = "Notepad ++-"; this.Documents = new ObservableCollection <IDocumentViewModel>(); this.NewDocumentCommand = new RelayCommand(this.CreateNewDocument); this.SaveCommand = new RelayCommand(this.Save, this.CanSave); }
public MainViewModel(IViewAdapter viewAdapter, IContactsService contactsService, IAppViewModelFactory viewModelFactory) : base(viewAdapter) { this._contactsService = contactsService ?? throw new ArgumentNullException(nameof(contactsService)); this._viewModelFactory = viewModelFactory ?? throw new ArgumentNullException(nameof(viewModelFactory)); this.Contacts = new ObservableCollection <ContactModel>(); this.CreateContactCommand = new RelayCommand(this.CreateContact); this.EditContactCommand = new RelayCommand(this.EditContact, this.CanEditContact); this.DeleteContactCommand = new RelayCommand(this.DeleteContact, this.CanDeleteContact); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this.ShutdownMode = ShutdownMode.OnExplicitShutdown; IAppViewModelFactory viewModelFactory = CreateAndConfigureFactory(); IMainViewModel mainViewModel = viewModelFactory.ResolveViewModel <IMainViewModel>(); mainViewModel.Closed += (s, ea) => this.Shutdown(); mainViewModel.Show(); }
protected override void OnStartup(StartupEventArgs e) { IAppViewModelFactory viewModelFactory = this.ConfigureContainer(); ILoginViewModel loginViewModel = viewModelFactory.ResolveViewModel <ILoginViewModel>(); loginViewModel.ShowDialog(); if (loginViewModel.DialogResult != null) { IMainViewModel mainViewModel = viewModelFactory.ResolveViewModel <IMainViewModel>(); mainViewModel.Closed += (s, ea) => this.Shutdown(); mainViewModel.Show(); } else { this.Shutdown(); } }