コード例 #1
0
 void mi_Click(object sender, RoutedEventArgs e)
 {
     MenuItem mi = sender as MenuItem;
     ContextMenu cm = mi.Parent as ContextMenu;
     TextBlock curTvi = (TextBlock)cm.PlacementTarget;
     string groupName = curTvi.Text;
     int mealId = DbController.AddMeal("Новое блюдо", groupName);
     AddMealView am = new AddMealView(mealId);
     am.ShowDialog();
     viewModel = new MenuBookViewModel();
     TreeMeals.DataContext = viewModel;
 }
コード例 #2
0
 void mi_Corr(object sender, RoutedEventArgs e)
 {
     MenuItem mi = sender as MenuItem;
     ContextMenu cm = mi.Parent as ContextMenu;
     TextBlock curTvi = (TextBlock)cm.PlacementTarget;
     int mealId;
     using (Model1Container db = new Model1Container())
     {
         mealId = (from meal in db.Meal
                   where meal.Name.Equals(curTvi.Text)
                   select meal.MealPK).FirstOrDefault();
     }
     AddMealView am = new AddMealView(mealId);
     am.ShowDialog();
     viewModel = new MenuBookViewModel();
     TreeMeals.DataContext = viewModel;
 }
コード例 #3
0
 void add_Click(object sender, RoutedEventArgs e)
 {
     string groupName = "Супы";
     int mealId = DbController.AddMeal("Новое блюдо", groupName);
     AddMealView am = new AddMealView(mealId);
     am.ShowDialog();
     bookViewModel = new MenuBookViewModel();
     MBV1.TreeMeals.DataContext = bookViewModel;
 }
コード例 #4
0
 public void ViewMealMethod()
 {
     AddMealView am = new AddMealView(1);
     am.ShowDialog();
 }