private void btnUpdateDish_Click(object sender, EventArgs e)
 {
     foreach (var item in this.listView1.SelectedItems)
     {
         var obj  = item as ListViewItem;
         var dish = obj.Tag as Dish;
         var frm  = new FormUpdateDish(dish);
         if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             obj.Text = dish.Name;
         }
     }
 }
Exemplo n.º 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            var index = this.lstDish.SelectedIndex;

            if (0 <= index && index < this.lstDish.Items.Count)
            {
                var dish = this.lstDish.Items[index] as Dish;
                var frm  = new FormUpdateDish(dish);
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    this.lstDish.Items[index] = dish;
                }
            }
        }