/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { _instance = this; CarSelectionViewModel = new CarSelectionViewModel(); if (IsInDesignMode) { ActiveViewModel = new CarViewModel(null,null); } else { Project project = DataManager.Instance.LoadProject(); if (project != null && !String.IsNullOrEmpty(project.XmlDatabaseFilePath)) { try { DataManager.Instance.LoadCars(); NavigateToCarSelection(); }catch(Exception) { //TODO ERRORLOG ActiveViewModel = new CreateProjectViewModel(); RaisePropertyChanged(() => ActiveViewModel); } } else { ActiveViewModel = new CreateProjectViewModel(); RaisePropertyChanged(() => ActiveViewModel); } } }
public CarViewModel(Car car, CarSelectionViewModel parent) { Car = car; Parent = parent; }