Beispiel #1
0
        private void tsmiEditWord_Click(object sender, EventArgs e)
        {
            if (lvWords.SelectedItems.Count == 0)
            {
                return;
            }

            var wordViewItem = lvWords.SelectedItems[0] as WordViewItem;
            var wordInfo     = wordViewItem.WordInfo;
            var wordInfos    = lvWords.GetAsWordInfoList();

            using (var dialog = new EditWordInfoForm(this, Job.Edit, _cambridgeProvider, wordInfo, ref wordInfos))
            {
                var dialogResult = dialog.ShowDialog();
                if (dialogResult == DialogResult.Cancel)
                {
                    RemoveItemByWordInfo(wordViewItem.WordInfo, true);
                    return;
                }
                else if (dialogResult != DialogResult.OK)
                {
                    return;
                }

                dialog.WordInfo.ImportedIntoAnki = default(DateTime);
                wordViewItem.WordInfo            = dialog.WordInfo;
                rtbWordOutput.Text = _textFormatter.Render(dialog.WordInfo);
                _changeMade        = true;
            }
        }
Beispiel #2
0
        private void tsmiAddWord_Click(object sender, EventArgs e)
        {
            var wordInfos = lvWords.GetAsWordInfoList();

            var wordViewItem = new WordViewItem(string.Empty);

            lvWords.Items.Add(wordViewItem);

            using (var dialog = new EditWordInfoForm(this, Job.Add, _cambridgeProvider, wordViewItem.WordInfo, ref wordInfos))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    RemoveItemByWordInfo(wordViewItem.WordInfo, false);
                    return;
                }

                wordViewItem.WordInfo = dialog.WordInfo;
                RefreshWordColumn();
                _changeMade = true;
            }
        }