private async void btnLink_Click(object sender, RoutedEventArgs e) { SaveBtnUIStatus(); var result = new List <string>(); var watcher = new Stopwatch(); watcher.Start(); List <(int, int)> links_found = new List <(int, int)>(); if (cb_QuestType.SelectedIndex != 0) { links_found = await SentenceWpfController_Deprecated.LinkQuestType(stk_sentences, cb_QuestType.SelectedModalType, watcher); } else { links_found.AddRange(await SentenceWpfController_Deprecated.LinkQuestType(stk_sentences, Model.Voc, watcher)); // and so on; } RestoreBtnUIStatus(); Footer.Log(links_found.Count + " sentences were linked to Vocabulary. Time spent: " + Math.Round(watcher.Elapsed.TotalMinutes, 2) + " minutes."); }
private void Filter() { var watcher = new Stopwatch(); watcher.Start(); var inputFilter = txt_input.Text.Any() ? txt_input.Text : string.Empty; if (stk_sentences != null) { stk_sentences.Children.Clear(); } if (!inputFilter.IsEmpty()) { if (inputFilter.IsDigitsOnly() && SenControl_Deprecated.Get().Any(x => x.Id == Convert.ToInt16(inputFilter))) { var sen = SenControl_Deprecated.Get().First(x => x.Id == Convert.ToInt16(inputFilter)); SentenceWpfController_Deprecated.AddIntoItems(stk_sentences, sen, false); return; } } int count = 0; foreach (var sen in SenControl_Deprecated.Get()) { if (sen.Text != string.Empty && !sen.Text.ContainsInsensitive(inputFilter)) { continue; } if (!txt_quests.IsEmpty() && txt_quests.Text.IsDigitsOnly()) { var quant = Convert.ToInt16(txt_quests.Text); if (sen.Questions.Count != quant) { continue; } } if (cb_QuestType.SelectedIndex != 0) { if (!sen.Questions.Any(x => x.Quest.Type == cb_QuestType.SelectedModalType)) { continue; } } SentenceWpfController_Deprecated.AddIntoItems(stk_sentences, sen, false); count = count + 1; if (count == 60) { break; } } Footer.Log(count + " sentences loaded in " + watcher.Elapsed.TotalSeconds + " seconds."); }
private void Insert_Click(object sender, RoutedEventArgs e) { var sen = txt_input.Text; var vm = new SenVM_Deprecated(sen); if (SenControl_Deprecated.Insert(vm, true)) { //LoadSentencesOnGrid(true); txt_input.Text = string.Empty; var added = SenControl_Deprecated.Get().Last(); SentenceWpfController_Deprecated.AddIntoItems(stk_sentences, added, true); Footer.Log("The sentence has been inserted."); } }
private void InsertLinkLoad(List <string> sentencesFound) { int auto_inserted = 0; foreach (var found in sentencesFound) { var vm = new SenVM_Deprecated(found); if (SenControl_Deprecated.Insert(vm, false)) { var added_sen = SenControl_Deprecated.Get().Last(); SentenceWpfController_Deprecated.AddIntoItems(stk_sentences, added_sen, true); auto_inserted = auto_inserted + 1; } } Footer.Log("Auto insert has finished. " + auto_inserted + " sentences were inserted."); }
private void LoadSentencesOnGrid(bool isGridUpdate) { var watcher = new Stopwatch(); watcher.Start(); var sens = SenControl_Deprecated.Get(); SenControl_Deprecated.PopulateQuestions(); sens = sens.Take(60); foreach (var sen in sens) { SentenceWpfController_Deprecated.AddIntoItems(stk_sentences, sen, false); } Footer.Log(sens.Count() + " sentences loaded in " + Math.Round(watcher.Elapsed.TotalSeconds, 2) + " seconds."); }