protected virtual TViewModel CreateInstance(TModel model) { var vm = viewModelFactory.CreateViewModel <TViewModel, TModel> (model); modelToViewModel [model] = vm; return(vm); }
public ShellViewModel(IViewModelFactoryService viewModelFactoryService) { _ViewModelFactoryService = viewModelFactoryService; ServerSelectCommand = new Command(ServerSelect); _ConnectionViewModel = _ViewModelFactoryService.CreateViewModel <ConnectionViewModel>(); CurrentViewModel = _ConnectionViewModel; }
public MainWindowViewModel(IViewModelFactoryService viewModelFactoryService) { _viewModelFactoryService = viewModelFactoryService; CurrentControls = new List <UserControl>(); CurrentControls.Add(new TechnologicalProcessView() { DataContext = (TechnologicalProcessViewModel)_viewModelFactoryService.CreateViewModel(ViewType.TechnologicalProcess) }); CurrentControls.Add(new DatabaseView() { DataContext = (DatabaseViewModel)_viewModelFactoryService.CreateViewModel(ViewType.Database) }); ShowTreeViewCommand = new DelegateCommand((o) => ShowTreeView()); ShowDatabaseViewCommand = new DelegateCommand((o) => ShowDatabaseView()); CloseApplicationCommand = new DelegateCommand((o) => Environment.Exit(0)); }