private void DeleteWord() { var selected = (VocabularyWord)CurrentController.ListView.SelectedItem.Tag; CurrentBook.Words.Remove(selected); BtnAddWord.Focus(); }
private void PracticeWords() { using (var countDialog = new PracticeCountDialog(CurrentBook)) { if (countDialog.ShowDialog() != DialogResult.OK) { return; } var practiceList = countDialog.PracticeList; CurrentController.ListView.Visible = false; using (var dialog = new PracticeDialog(CurrentBook, practiceList) { Owner = this }) { dialog.ShowDialog(); } if (Settings.Default.PracticeShowResultList) { using (var dialog = new PracticeResultList(CurrentBook, practiceList)) { dialog.ShowDialog(); } } CurrentController.ListView.Visible = true; BtnAddWord.Focus(); } }
private void EditBook() { using (var dialog = new VocabularyBookSettings(CurrentBook) { Owner = this }) dialog.ShowDialog(); BtnAddWord.Focus(); }
private void AddWord() { using (var dialog = new AddWordDialog(CurrentBook) { Owner = this }) dialog.ShowDialog(); BtnAddWord.Focus(); }
public void EditWord() { VocabularyWord selected = (VocabularyWord)CurrentController.ListView.SelectedItem.Tag; using (var dialog = new EditWordDialog(CurrentBook, selected) { Owner = this }) dialog.ShowDialog(); CurrentController.ListView.SelectedItem.EnsureVisible(); BtnAddWord.Focus(); }
private void DeleteWord() { int index = CurrentController.ListView.SelectedItem.Index; VocabularyWord selected = (VocabularyWord)CurrentController.ListView.SelectedItem.Tag; CurrentBook.Words.Remove(selected); // Limit index of the deleted word to the highest possible index index = Math.Min(index, CurrentBook.Words.Count - 1); foreach (ListViewItem item in CurrentController.ListView.Items) { if (item.Index == index) { item.Selected = true; } } BtnAddWord.Focus(); }
private void CreateBook() { using (var dialog = new VocabularyBookSettings(out var book)) { if (dialog.ShowDialog() == DialogResult.OK) { if (CurrentBook != null) { if (UnsavedChanges && !EnsureSaved()) { return; } UnloadBook(false); } // VocabularyBookSettings enables notification on creation LoadBook(book); BtnAddWord.Focus(); } } }