示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var meal = listBox1.SelectedItem;

            var selectedMeal = Context.Meals.FirstOrDefault(m => m.Name == meal.ToString());

            Form editMeal = new EditMeal(this, selectedMeal);

            editMeal.Focus();
            editMeal.ShowDialog();
        }
示例#2
0
        private void editButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                nameFood = mealName.Text;

                EditMeal editmeal = new EditMeal(mealName.Text);

                editmeal.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }