private void Main() { Stack.Background = SettingApp.BackgroundColor; List <TaskTest> tst; Stack.Children.Clear(); using (PhysicsContext db = new PhysicsContext()) { tst = db.Tests.ToList(); } //flipView.Items.Add(new StackPanel()); int k = 0; foreach (TaskTest tr in tst) { k++; Stack.Children.Add(new Exep(tr.content, tr.answers, tr.answer, tr.type, "Задача " + k) { Margin = new Thickness(10) }); } }
private void updateBd(int setForm) { using (PhysicsContext db = new PhysicsContext()) { Formul forml1 = db.Formuls.FirstOrDefault(c => c.Id == idF); if (forml1 != null) { forml1.addF = setForm; db.Formuls.Update(forml1); db.SaveChanges(); } } }
public void Content() { changedFV.Background = SettingApp.BackgroundColor; List <Ptable> ptab; List <Formul> forl; changedFV.Items.Clear(); ScrollViewer sv = new ScrollViewer(); sv.Content = addStack(addTitleFirsDiscript("Содержание")); changedFV.Items.Add(sv); using (PhysicsContext db = new PhysicsContext()) { ptab = db.Ptables.ToList(); forl = db.Formuls.ToList(); } //flipView.Items.Add(new StackPanel()); foreach (Ptable pt in ptab) { if (pt.type == "text") { addMegaText(pt.mcontent); } else if (pt.type == "button") { ChangedFV.Items.Add(addButton(pt.mcontent)); } else if (pt.type == "image") { addMegaImage(pt.mcontent); } else if (pt.type == "title") { ChangedFV.Items.Add(addTitle(pt.mcontent)); } else if (pt.type == "formyl") { Formul formTemp = new Formul(); foreach (Formul fr in forl) { if (fr.Id.ToString() == pt.mcontent) { formTemp = fr; } } //ChangedFV.Items.Add(addFormyl(formTemp)); addFormyl(formTemp); } else if (pt.type == "animation2") { ChangedFV.Items.Add(addStack(addStack(new Animation2() { HorizontalAlignment = HorizontalAlignment.Center }))); } else if (pt.type == "animation1") { ChangedFV.Items.Add(addStack(new Animation1() { HorizontalAlignment = HorizontalAlignment.Center })); } } double s = (Math.Round(CountPageFV * SettingApp.ProcentPage, 0)); if (!Double.IsInfinity(s) && !Double.IsNaN(s)) { int sel = Convert.ToInt32(s); changedFV.SelectedIndex = sel; } OnPropertyChanged("CountPageFV"); OnPropertyChanged("SelectPageFV"); }