protected override void OnDeactivated(EventArgs e) { // save the current recipe before shutting down RecipesView recipesView = (RecipesView)MainWindow.FindName("RecipesView"); RecipesViewModel recipesViewModel = (RecipesViewModel)recipesView.DataContext; recipesViewModel.SaveCurrentRecipe(); // save the current batch before shutting down BatchesView batchesView = (BatchesView)MainWindow.FindName("BatchesView"); BatchesViewModel batchesViewModel = (BatchesViewModel)batchesView.DataContext; batchesViewModel.SaveCurrentBatch(); base.OnDeactivated(e); }
private void UserControl_GotFocus(object sender, System.Windows.RoutedEventArgs e) { RecipesViewModel viewModel = (RecipesViewModel)DataContext; viewModel.GetSettings(); }
private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { RecipesViewModel viewModel = (RecipesViewModel)DataContext; viewModel.CurrentRecipe.UpdateRecipeOutcome(); }