private void Button_Add_Event(object sender, RoutedEventArgs e) { AddGadget window = new AddGadget(); window.ShowDialog(); if (window.myGadget != null) { GadgetItems.Add(window.myGadget); } }
private void AddGadget_Click(object sender, RoutedEventArgs e) { var gadgetWindow = new AddGadget(); var dialog = gadgetWindow.ShowDialog(); if (dialog == true) { Console.WriteLine("Neues Gadget erfasst"); } else { Console.WriteLine("Alles ist abgebrochen"); } }