void listOptionMenuForm_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { FormMenuItemWpf item = listOptionMenuForm.SelectedItem as FormMenuItemWpf; if (item != null) { textBoxText.Text = item.Text; checkBoxBold.IsChecked = item.Bold; textBoxHelp.Text = item.HelpText; isUpdateItemAction = true; this.buttonAdd.Content = "Update"; if (item.InputDataContext == null) { radioNone.IsChecked = true; } else { loadRealtedTables(); comboBoxOutput.SelectedItem = item.InputDataContext; } this.EnableOutputContext(false); } } catch (Exception error) { Util.ShowErrorDialog(UtnEmall.ServerManager.Properties.Resources.UnhandledError + ": " + error.Message); } }
private FormMenuItemWpf generateItem() { FormMenuItemWpf item = new FormMenuItemWpf(this.textBoxText.Text, this.textBoxHelp.Text, FontName.Arial); if (radioRegister.IsChecked == true) { item.InputDataContext = this.menuFormWPF.InputDataContext; item.OutputDataContext = item.InputDataContext; } else if (radioList.IsChecked == true) { item.InputDataContext = comboBoxOutput.SelectedItem as LogicalLibrary.DataModelClasses.Table; item.OutputDataContext = item.InputDataContext; } else { item.InputDataContext = null; item.OutputDataContext = null; } item.FontName = FontName.Arial; item.Bold = (bool)checkBoxBold.IsChecked; return(item); }
private void buttonAdd_Click(object sender, RoutedEventArgs e) { try { if (String.IsNullOrEmpty(textBoxText.Text.Trim())) { Util.ShowInformationDialog(UtnEmall.ServerManager.Properties.Resources.EmptyText, UtnEmall.ServerManager.Properties.Resources.Error); return; } if (isUpdateItemAction) { FormMenuItemWpf selectedItem = listOptionMenuForm.SelectedItem as FormMenuItemWpf; selectedItem.Text = this.textBoxText.Text; selectedItem.HelpText = this.textBoxHelp.Text; resetUpdate(); } else { FormMenuItemWpf itemGenerated = generateItem(); listOptionMenuForm.Items.Add(itemGenerated); } clearTextBoxs(); loadRealtedTables(); UpdateListOption(); buttonAdd.Content = UtnEmall.ServerManager.Properties.Resources.Add; EnableOutputContext(true); textBoxText.Focus(); } catch (NullReferenceException error) { Util.ShowErrorDialog(UtnEmall.ServerManager.Properties.Resources.UnhandledError + ": " + error.Message); } catch (Exception error) { Util.ShowErrorDialog(UtnEmall.ServerManager.Properties.Resources.UnhandledError + ": " + error.Message); } }