public DefaultViewModelFactory([NotNull] SuperheroesViewModel superheroesViewModel, IApplicationRepository repository) { if (superheroesViewModel == null) throw new ArgumentNullException(nameof(superheroesViewModel)); if (repository == null) throw new ArgumentNullException(nameof(repository)); this.superheroesViewModel = superheroesViewModel; this.repository = repository; }
public ApplicationViewModel([NotNull] IViewModelFactory viewModelFactory, SuperheroesViewModel superheroesViewModel) { if (viewModelFactory == null) throw new ArgumentNullException(nameof(viewModelFactory)); if (superheroesViewModel == null) throw new ArgumentNullException(nameof(superheroesViewModel)); this.viewModelFactory = viewModelFactory; SuperheroesViewModel = superheroesViewModel; InitializeEvents(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); using (var repository = new DefaultApplicationRepository("http://localhost:50673/")) { SuperheroesViewModel superheroesViewModel = new SuperheroesViewModel(repository); IViewModelFactory viewModelFactory = new DefaultViewModelFactory(superheroesViewModel, repository); ApplicationViewModel applicationViewModel = new ApplicationViewModel(viewModelFactory, superheroesViewModel); MainWindow mainWindow = new MainWindow(applicationViewModel); mainWindow.ShowDialog(); } }