Example #1
0
        private void DeleteGadget_Click(object sender, RoutedEventArgs e)
        {
            if (gadgetGrid.SelectedItem == null)
            {
                MessageBox.Show("No Item selected!");
            }
            else
            {
                Gadget selectedGadget = (Gadget)gadgetGrid.SelectedItem;

                deleteGadget deleteWindow = new deleteGadget(selectedGadget);
                deleteWindow.Show();
                deleteWindow.Yes_Button.Click += delegate
                {
                    if (service.DeleteGadget(selectedGadget))
                    {
                        //MessageBox.Show("Gadget successfully deleted!");
                        deleteWindow.Close();
                    }
                    else
                    {
                        MessageBox.Show("Operation failed!");
                    }
                };
                deleteWindow.Closed += delegate(object s, EventArgs a)
                {
                    RefreshGadgets();
                };
            }
        }
        private void DeleteGadget_Click(object sender, RoutedEventArgs e)
        {
            if (gadgetGrid.SelectedItem == null)
            {
                MessageBox.Show("No Item selected!");
            }else
            {
                Gadget selectedGadget = (Gadget)gadgetGrid.SelectedItem;

                deleteGadget deleteWindow = new deleteGadget(selectedGadget);
                deleteWindow.Show();
                deleteWindow.Yes_Button.Click += delegate
                {
                    if (service.DeleteGadget(selectedGadget))
                    {
                        //MessageBox.Show("Gadget successfully deleted!");
                        deleteWindow.Close();
                    }
                    else
                    {
                        MessageBox.Show("Operation failed!");
                    }
                };
                deleteWindow.Closed += delegate (object s, EventArgs a)
                {
                    RefreshGadgets();
                };
            }
        }