Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (tbWords.Text.Trim() == "")
            {
                ToastNotification.Show(this, "You must input at least one word!", null, 2000, eToastGlowColor.Red);
                return;
            }
            int count = tbWords.Lines.Count(), js = 0;

            foreach (var word in tbWords.Lines)
            {
                string new_word = word.Trim();
                if (new_word != "")
                {
                    this.Text  = originTitle + " ( " + ((double)++js * 100.0 / (double)count) + "% )";
                    cmdAddWord = new SQLiteCommand(strSQLInsert, Gib.con);
                    cmdAddWord.Parameters.AddWithValue("@word", new_word);
                    cmdAddWord.Parameters.AddWithValue("@trans", lookupDict(new_word));
                    cmdAddWord.Parameters.AddWithValue("@group", Gib.curGroup);
                    cmdAddWord.Parameters.AddWithValue("@state", 0);
                    cmdAddWord.Parameters.AddWithValue("@gamestate", 0);
                    cmdAddWord.ExecuteNonQuery();
                }
            }
            this.Text = originTitle + " ( 100% )";
            MessageBox.Show(js + " word" + (js > 1 ? "s" : "") + " added");
            FrmMain frm = (FrmMain)this.Owner;

            frm.refreshWords();
            tbWords.Text = "";
            this.Close();
        }
Ejemplo n.º 2
0
        private void FrmAddWord_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (tbWords.Text.Trim() != "")
            {
                if (MessageBox.Show(this, "Are you sure you want to discard these words you've entered?",
                                    "CW Study Tool", MessageBoxButtons.YesNo, MessageBoxIcon.Warning,
                                    MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    e.Cancel = true;
                }
            }
            FrmMain frm = (FrmMain)this.Owner;

            frm.refreshWords();
        }
Ejemplo n.º 3
0
        private void FrmStudy_FormClosed(object sender, FormClosedEventArgs e)
        {
            FrmMain frm = (FrmMain)this.Owner;

            frm.refreshWords();
        }
Ejemplo n.º 4
0
        private void FrmAddWord_FormClosing(object sender, FormClosingEventArgs e)
        {
            FrmMain frm = (FrmMain)this.Owner;

            frm.refreshWords();
        }