示例#1
0
        // ContextMenu Items
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // What I can do here is have it createa a new blank vocab object.
            AddUpdateDialog addDialog = new AddUpdateDialog();

            Vocab vocabItem = new Vocab();

            addDialog.Text = "Add Vocab";
            addDialog.Tag  = vocabItem;

            if (addDialog.ShowDialog(this) == DialogResult.OK)
            {
                if (!(string.IsNullOrWhiteSpace(vocabItem.PhraseIn)))
                {
                    // add VocabList item into List
                    vocabList.Add(new Vocab(vocabItem.PhraseIn, vocabItem.PhraseOut, vocabItem.URL, vocabItem.Tag));

                    UpdateValues();

                    UpdateSelection(vocabItem);
                }
            }

            addDialog.Dispose();
        }
示例#2
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int   listIndex;
            Vocab vocabItem;

            // What I can do here is have it createa a new blank vocab object.
            AddUpdateDialog updateDialog = new AddUpdateDialog();

            listIndex         = this.dgvVocab.CurrentRow.Index;
            vocabItem         = this.vocabList[listIndex];
            updateDialog.Text = "Update Vocab";
            updateDialog.Tag  = vocabItem;

            if (updateDialog.ShowDialog(this) == DialogResult.OK)
            {
                UpdateValues();

                UpdateSelection(vocabItem);
            }

            updateDialog.Dispose();
        }