// ----- Methods ----- // Change Main Window Content (Change Datacontent) public void ChangePage(string _route) { switch (_route) { case "menu": DataContext = menuView; return; case "addWork": if (addWorkView == null) { this.addWorkViewModel = new AddWorkViewModel(model); addWorkView = new AddWorkView(addWorkViewModel, this); } DataContext = addWorkView; return; case "settings": if (settingsView == null) { this.settingsViewModel = new SettingsViewModel(model); settingsView = new SettingsView(settingsViewModel, this); } DataContext = settingsView; return; } }
private void AddWorkHandler(object sender, EventArgs e) { //if (_selectedCar == null) return; var sendvm = sender as CarDetailViewModel; if (sendvm == null) { return; } var cntrl = new AddWorkView(); var vm = cntrl.DataContext as AddWorkViewModel; if (vm != null) { vm.CancelHandler += CancelHandler; //vm.GetListService(sendvm.CarNumber); } InfoBlock = cntrl; }