Ejemplo n.º 1
0
        private void DeleteWord()
        {
            var selected = (VocabularyWord)CurrentController.ListView.SelectedItem.Tag;

            CurrentBook.Words.Remove(selected);
            BtnAddWord.Focus();
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
 private void EditBook()
 {
     using (var dialog = new VocabularyBookSettings(CurrentBook)
     {
         Owner = this
     }) dialog.ShowDialog();
     BtnAddWord.Focus();
 }
Ejemplo n.º 4
0
 private void AddWord()
 {
     using (var dialog = new AddWordDialog(CurrentBook)
     {
         Owner = this
     }) dialog.ShowDialog();
     BtnAddWord.Focus();
 }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
        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();
                }
            }
        }