Пример #1
0
        private void AddWordList(int num)
        {
            int count = words.Count;
            int i     = 0;

            foreach (var str in words)
            {
                if (count != 0)
                {
                    num = 1 + i * 100 / count;
                }
                else
                {
                    num = 0;
                }
                string trans = AddTrans(str);
                if (trans.Trim() != "")
                {
                    if (WordDataHelper.GetProgress(str) < AppInfoHelper.GetReciteNumber())
                    {
                        wordList.Add(str);
                        transList.Add(trans);
                    }
                }
                Thread a = new Thread(AnotherProcess);
                a.IsBackground = true;
                a.Start(num);
                i++;
            }
        }
Пример #2
0
 private void TsmGrasp_Click(object sender, EventArgs e)
 {
     //WordDataHelper.AddWordData(currentlabel.Text, 0);
     WordDataHelper.AutoAddProgress(currentlabel.Text);
     currentlabel.ForeColor = SetColor(currentlabel.Text);
     currentlabel.BackColor = SystemColors.Control;
 }
Пример #3
0
 private void BtnUngrasp_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < LbxWord.SelectedItems.Count; i++)
     {
         WordDataHelper.AddWordData(LbxWord.SelectedItems[i].ToString(), 1);
         WordDataHelper.AutoSubtractProgress(LbxWord.SelectedItems[i].ToString());
     }
 }
Пример #4
0
        private void GenerateWordbooklist()
        {
            wordbooklist = new List <string>();
            WordDataHelper.WordbookListInFolder(AppInfoHelper.GetMyWordBookFolder(), wordbooklist);
            List <string> dictlist = new List <string>();

            dictlist = DictHelper.ReadDictList();
            for (int i = 0; i < dictlist.Count; i++)
            {
                wordbooklist.Add(dictlist[i]);
            }
        }
Пример #5
0
 /// <summary>
 /// 标记为会,并从列表中删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TsmGrasp_Click(object sender, EventArgs e)
 {
     WordDataHelper.AutoAddProgress(LbxWord.SelectedItem.ToString());
     for (int i = 0; i < LbxWord.Items.Count; i++)
     {
         if (LbxWord.GetSelected(i))
         {
             LbxWord.Items.RemoveAt(i);
             transList.RemoveAt(i);
             i--;
         }
     }
 }
Пример #6
0
        private Color SetColor(string word)
        {
            int   progress = WordDataHelper.GetProgress(word);
            Color color    = new Color();

            if (progress == AppInfoHelper.GetReciteNumber())
            {
                color = Color.FromArgb(34, 177, 76);
            }
            if (progress < 0)
            {
                color = Color.Red;
            }
            return(color);
        }
Пример #7
0
        private void FillModel(WordData model, Language language, List <Word> words, CategorizedWord catWord)
        {
            var category     = _context.Categories.Find(catWord.CategoryId);
            var translations = _context.Translations.Where(t => t.CategorizedWordId == catWord.Id).ToList();
            var helper       = new WordDataHelper(_context, _accessor);

            model.WordId         = catWord.WordId;
            model.Word           = words.Find(w => w.Id == catWord.WordId).ThisWord;
            model.LanguageId     = language.Id;
            model.Language       = language.Name;
            model.CategoryId     = catWord.CategoryId;
            model.Category       = catWord.Category.Name;
            model.CatWordId      = catWord.Id;
            model.TranslationIds = helper.TranslationIdsToString(translations);
            model.Translation    = helper.TranslationsToString(translations);
        }
Пример #8
0
        private void AddWordList(bool model)
        {
            List <string> dict = new List <string>();

            WordDataHelper.WordbookListInFolder(AppInfoHelper.GetRecord(), dict);
            if (dict.Contains(CbxWordbook.Text))
            {
            }
            else
            {
                if (model)
                {
                    l.Clear();
                }
                l = WordDataHelper.GenerateWordbook(String.Format("{0}\\{1}.xml", AppInfoHelper.GetDictionaryFolder(), CbxWordbook.Text));
            }
        }
Пример #9
0
 private void BtnCool_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < LbxWord.SelectedItems.Count; i++)
     {
         for (int j = 0; j < 10; j++)
         {
             WordDataHelper.AddWordData(LbxWord.SelectedItems[i].ToString(), 0);
             WordDataHelper.AutoAddProgress(LbxWord.SelectedItems[i].ToString());
         }
     }
     for (int i = 0; i < LbxWord.Items.Count; i++)
     {
         if (LbxWord.GetSelected(i))
         {
             LbxWord.Items.RemoveAt(i);
             transList.RemoveAt(i);
             i--;
         }
     }
 }
Пример #10
0
 private void TsmUnGrasp_Click(object sender, EventArgs e)
 {
     WordDataHelper.AutoSubtractProgress(LbxWord.SelectedItem.ToString());
 }
Пример #11
0
 public WordDataController(DBDictionaryContext context, IHttpContextAccessor accessor)
 {
     _context = context;
     _helper  = new WordDataHelper(context, accessor);
     _user    = accessor.HttpContext.User;
 }
Пример #12
0
 private void TsmUngrasp_Click(object sender, EventArgs e)
 {
     WordDataHelper.AutoSubtractProgress(currentlabel.Text);
     currentlabel.ForeColor = SetColor(currentlabel.Text);
     currentlabel.BackColor = SystemColors.Control;
 }