public static void AddIntoThis(SenVM_Deprecated sen, StackPanel item_line) { item_line.Children.Clear(); var row1 = MyGrids.GetRowItem(new List <int>() { 18, 1, 1, 1 }, item_line); row1.Margin = new Thickness(2, 2, 1, 0); var row3 = new StackPanel(); row3.Margin = new Thickness(1, 2, 1, 2); item_line.Children.Add(row3); var stack_quests = new StackPanel(); var txt_sen = new TextBox(); //var btn_edit = MyBtns.Sen_Edit(0, 2, row1, sen, item_line, txt_sen, stack_quests); MyTxts.Get(txt_sen, 0, 0, row1, sen.Text); //txt_sen.TextChanged += (source, e) => CheckIfItemWasEdited(sen, txt_sen, btn_edit); //var show_quests = MyBtns.Sen_show_questions(0, 1, row1, sen, stack_quests); //var btn_remove = MyBtns.Remove_sentence(0, 3, row1, sen, item_line); //MyStacks.Sen_quests(stack_quests, sen, row3); }
public static void AddIntoItems(StackPanel stack_items, SenVM_Deprecated sen, bool isNew) { var item_line = MyStacks.GetItemLine(stack_items, isNew); item_line.Margin = new Thickness(0, 1, 2, 0); item_line.Name = "line_" + sen.Id; AddIntoThis(sen, item_line); }
public static bool Insert(SenVM_Deprecated sentence, bool showErrorsbox) { if (!IsSentenceValid(sentence.Text, showErrorsbox)) { return(false); } //InsertSentence(sentence); return(true); }
public static bool Update(SenVM_Deprecated sentence) { if (!IsSentenceValid(sentence.Text, true)) { return(false); } //UpdateSentence(sentence); //var oldSen = Sentences.FindIndex(x => x.Id == sentence.Id); //Sentences.Insert(oldSen, sentence); return(true); }
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 static void CheckIfItemWasEdited(SenVM_Deprecated sen, TextBox txt_sen, Button btn_edit) { var wasTextEdited = txt_sen.Text != sen.Text; if (wasTextEdited) { btn_edit.IsEnabled = true; btn_edit.Content = UtilWPF.GetIconButton("save"); } else { btn_edit.IsEnabled = false; btn_edit.Content = new FormatConvertedBitmap(btn_edit.Content as BitmapSource, PixelFormats.Gray32Float, null, 50); } }
public static void Remove(SenVM_Deprecated sentence) { //RemoveSentence(sentence); var qs_from_sentence = QuestSenControl_Deprecated.Get(Model.Voc).Where(x => x.IdSen == sentence.Id).ToList(); if (qs_from_sentence.Any()) { foreach (var qs in qs_from_sentence) { QuestSenControl_Deprecated.Remove(qs); var changedVoc = QuestControl.Get(Model.Voc).Where(y => y.Id == qs.IdQuest).First(); changedVoc.LoadCrossData(); } } }
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."); }