Beispiel #1
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            string engW = tbEngWord.Text.ToLower().Trim();
            string rusW = tbRusWords.Text.ToLower().Trim();

            if (engW.Equals("") || rusW.Equals(""))
            {
                lbTitleAddWord.Text = "Add new word into dictionary : fill words";
                return;
            }

            char[]   separators  = { '\n', ',', '.' };
            string[] rusWordsArr = rusW.Split(separators);
            for (int i = 0; i < rusWordsArr.Length; i++)
            {
                rusWordsArr[i] = rusWordsArr[i].Trim();
            }

            List <string> newRusWords = new List <string>();

            for (int i = 0; i < rusWordsArr.Length; i++)
            {
                if (!rusWordsArr[i].Equals(""))
                {
                    newRusWords.Add(rusWordsArr[i]);
                }
            }


            TWord newTWord = new TWord(engW, newRusWords, AddWordType);

            tbEngWord.Text  = "";
            tbRusWords.Text = "";
            if (DictCont == null)
            {
                DictCont = new List <TWord>();
            }
            DictCont.Add(newTWord);
            lbTitleAddWord.Text = "Add new word into dictionary : word added";


            UpdateDictionary();
        }
Beispiel #2
0
 public TWordExam(TWord tWord)
 {
     ExamRusWord = null;
     Word        = tWord;
 }
Beispiel #3
0
 public TWordExam()
 {
     ExamRusWord = null;
     Word        = null;
 }
Beispiel #4
0
        public Form1()
        {
            InitializeComponent();

            rbNoun.Checked = true;
            AddWordType    = WordType.Noun;


            DictCont = new List <TWord>();


            TWord w1 = new TWord("evgen", new List <string> {
                "евгений", "евген"
            }, WordType.Noun);
            TWord w2 = new TWord("will", new List <string> {
                "будет"
            }, WordType.Verb);
            TWord w3 = new TWord("pass", new List <string> {
                "сдавать", "пропускать"
            }, WordType.Verb);
            TWord w4 = new TWord("exam", new List <string> {
                "экзамен"
            }, WordType.Noun);
            TWord w5 = new TWord("on", new List <string> {
                "по", "в", "на"
            }, WordType.NA);
            TWord w6 = new TWord("csharp", new List <string> {
                "си шарп", "сишарп", "с#"
            }, WordType.Noun);
            TWord w7 = new TWord("excellent", new List <string> {
                "отлично"
            }, WordType.NA);
            TWord w8 = new TWord("rapid", new List <string> {
                "быстрый", "крутой", "скоростной"
            }, WordType.Adjective);

            DictCont.Add(w1);
            DictCont.Add(w2);
            DictCont.Add(w3);
            DictCont.Add(w4);
            DictCont.Add(w5);
            DictCont.Add(w6);
            DictCont.Add(w7);
            DictCont.Add(w8);


            UpdateDictionary();
            UpdateExamWordRange();


            // handlers declarations

            btnAddWord.Click       += BtnAdd_Click;
            btnDeleteWord.Click    += BtnDeleteWord_Click;
            btnDelDict.Click       += BtnDelDict_Click;
            btnResetProgress.Click += BtnResetProgress_Click;

            btnSaveBin.Click += BtnSaveBin_Click;
            btnLoadBin.Click += BtnLoadBin_Click;
            btnSaveXml.Click += BtnSaveXml_Click;
            btnLoadXml.Click += BtnLoadXml_Click;

            btnExamStart.Click    += BtnExamStart_Click;
            btnExamContinue.Click += BtnExamContinue_Click;

            tbExamRusWord.GotFocus  += (o, e) => { ExamRusWordFocus = true; };
            tbExamRusWord.LostFocus += (o, e) => { ExamRusWordFocus = false; };

            rbNoun.CheckedChanged += (o, e) => { AddWordType = WordType.Noun; };
            rbAdj.CheckedChanged  += (o, e) => { AddWordType = WordType.Adjective; };
            rbVerb.CheckedChanged += (o, e) => { AddWordType = WordType.Verb; };
            rbNA.CheckedChanged   += (o, e) => { AddWordType = WordType.NA; };

            tbEngWordDelete.Enter += (o, e) => { lbTitleDeleteWord.Text = "Delete word from dictionary"; };
            tbEngWord.Enter       += (o, e) => { lbTitleAddWord.Text = "Add new word into dictionary"; };
            tbRusWords.Enter      += (o, e) => { lbTitleAddWord.Text = "Add new word into dictionary"; };

            trExamWordsRange.ValueChanged += TrExamWordsRange_ValueChanged;
        }