コード例 #1
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            var gadgetToEdit = (Gadget)DgGadgets.SelectedItem;
            var dialog       = new GadgetDialog(gadgetToEdit);

            dialog.ActionText.Text = "Gadget ändern";
            dialog.Title           = "Gadget bearbeiten";
            if (dialog.ShowDialog() == false)
            {
                return;
            }
            _service.UpdateGadget(gadgetToEdit);
            LoadData();
            DgGadgets.SelectedItem = gadgetToEdit;
        }
コード例 #2
0
        private void addNewGadget_Click(object sender, RoutedEventArgs e)
        {
            var newGadget = new Gadget("");
            var dialog    = new GadgetDialog(newGadget);

            dialog.Title           = "Neues Gadget";
            dialog.ActionText.Text = "Gadget erstellen";
            if (dialog.ShowDialog() == false)
            {
                return;
            }
            _service.AddGadget(newGadget);
            LoadData();
            DgGadgets.SelectedItem = newGadget;
        }