Ejemplo n.º 1
0
        private void loadButton_Click(object sender, EventArgs e)
        {
            if (excelApp == null)
            {
                string pathToExcel = FileSaver.OpenExcelFile();
                if (DM.PathToExcel == "")
                {
                    MessageBox.Show("Файл " + DM.PathToExcel + " не найден");
                    return;
                }
                excelApp = new ExcelManager();
                excelApp.Open(DM.PathToExcel);
            }
            memo = new MemoManager(grid);

            List <string> lWords  = excelApp.GetColumn(DM.Columns.word);
            List <string> lfreq   = excelApp.GetColumn(DM.Columns.freq);
            List <string> lLvl    = excelApp.GetColumn(DM.Columns.level);
            List <string> ltrans1 = excelApp.GetColumn(DM.Columns.trans1);
            List <string> ltrans2 = excelApp.GetColumn(DM.Columns.trans2);
            List <string> ltrans3 = excelApp.GetColumn(DM.Columns.trans3);

            richTextBox1.Text = "";
            foreach (var item in countUnknownWords(lfreq, lLvl))
            {
                richTextBox1.Text += item.Key + " " + item.Value + "\r";
            }

            string lvlCondition = "0";

            if (unknownRadioButton.Checked)
            {
                lvlCondition = unknownRadioButton.Text;
            }
            if (fogottenRadioButton.Checked)
            {
                lvlCondition = fogottenRadioButton.Text;
            }
            if (studiedRadioButton.Checked)
            {
                lvlCondition = studiedRadioButton.Text;
            }

            int minFreq  = Convert.ToInt16(minFreqTextBox.Text);
            int maxWords = Convert.ToInt16(maxRndTextBox.Text);

            for (int i = 0; i < lWords.Count && memo.study.Count < maxWords; i++)
            {
                if (lLvl[i] == lvlCondition && Convert.ToInt16(lfreq[i]) >= minFreq)
                {
                    memo.AddStudy(lWords[i], i, ltrans1[i] + "," + ltrans2[i] + "," + ltrans3[i]);
                    for (int j = 0; j < WordsFormer.maxExamples; j++)
                    {
                        if (excelApp.GetValue(j + WordsFormer.whereExamplesStart, i + 2) != "")
                        {
                            memo.study[memo.study.Count - 1].AddEx(excelApp.GetValue(j + WordsFormer.whereExamplesStart, i + 2));
                        }
                    }
                    Text = i.ToString() + " Слов " + memo.study.Count.ToString();
                }
            }
            memo.FillGrid();
            memo.ApplyParams(Convert.ToInt16(rangeTextBox.Text));
            richTextBox1.Focus();
            //nextButton_Click(null, null);
        }
Ejemplo n.º 2
0
 private void MemorizerForm_Load(object sender, EventArgs e)
 {
     t1    = DateTime.Now;
     saver = new FileSaver();
     memo  = new MemoManager(grid);
 }