private void GotoScreen(ScreenType targetScreenType) { currentScreenType = targetScreenType; ReleaseCheckedMenu(); switch (targetScreenType) { case ScreenType.Welcome: _ = new WelcomeForm { panel1 = { Parent = panel1 } }; break; case ScreenType.ListBox: _ = new ListBoxForm(propMenuItem) { panel1 = { Parent = panel1 } }; listMenuItem.Checked = true; break; case ScreenType.TwoListBoxes: _ = new TwoListBoxesForm(propMenuItem) { panel1 = { Parent = panel1 } }; twoListMenuItem.Checked = true; break; default: throw new ArgumentOutOfRangeException(nameof(targetScreenType), targetScreenType, null); } }
//Function clear public void ClearObject() { TxtAngka1Form.Text = ""; TxtAngka2Form.Text = ""; TxtPasswordForm.Text = ""; CheckBoxForm.Checked = false; CheckBoxListForm.ClearSelection(); RadioButtonForm.Checked = false; RadioButtonListForm.ClearSelection(); DropDownListForm.SelectedIndex = 0; ListBoxForm.ClearSelection(); }
private int ShowPopup(IList items) { int result = -1; ListBoxForm popup = new ListBoxForm(); ListBoxOptionsController popupController = new ListBoxOptionsController(popup, items); popupController.LoadView(); DialogResult dialogResult = popup.ShowDialog(); if (dialogResult == DialogResult.OK) { result = popupController.SelectedIndex; } return(result); }
public static Item ShowListBoxOptionsForm(IList items, Control parentControl) { Item result = new Item(); ListBoxForm popup = new ListBoxForm(); ListBoxOptionsController popupController = new ListBoxOptionsController(popup, items); popupController.LoadView(); DialogResult dialogResult = popup.ShowDialog(parentControl); if (dialogResult == DialogResult.OK) { result = popupController.SelectedItem; } popup.Dispose(); return(result); }
public bool AddToDictionary(string wordToAdd) { string[] dicSuggestions = m_engine.GetSimpleFormOfWord(wordToAdd); string selectedDicSuggestion = null; if (dicSuggestions.Length <= 0) { this.VerificationWindowInteractive.InvokeMethod(() => PersianMessageBox.Show(VerificationWindowInteractive.GetWin32Window(), "افزودن این واژه به واژهنامه ممکن نیست!")); } else if (dicSuggestions.Length == 1 && dicSuggestions[0] == wordToAdd) { selectedDicSuggestion = dicSuggestions[0]; } else { this.VerificationWindowInteractive.InvokeMethod(() => { selectedDicSuggestion = ListBoxForm.ShowListBoxForm( VerificationWindowInteractive.GetWin32Window(), dicSuggestions, wordToAdd, "کدام کلمه به واژهنامه افزوده شود؟ لطفاً سادهترین شکل معنادار کلمه را انتخاب کنید.", "افزودن به واژهنامه"); }); } if (selectedDicSuggestion != null) { if (m_engine.AddToDictionary(selectedDicSuggestion, wordToAdd, Globals.ThisAddIn.SpellCheckerWrapper.UserDictionary)) { //PersianMessageBox.Show(VerificationWindowInteractive.GetWin32Window(), "کلمه با موفقیت به واژهنامه افزوده شد"); LogHelper.Info(Constants.LogKeywords.EntryAddedToDictionary, selectedDicSuggestion); return(true); } this.VerificationWindowInteractive.InvokeMethod(() => PersianMessageBox.Show( VerificationWindowInteractive.GetWin32Window(), "این شکل از کلمه در واژهنامه وجود دارد!")); } return(false); }