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(); } } }
private void addFormyl(Formul formTemp) { FormulCase temp = new FormulCase(formTemp.description, formTemp.uriImage, formTemp.addF, formTemp.Id); temp.Width = SizeElement.Width - 90; if (ChangedFV.Items[ChangedFV.Items.Count - 1] is StackPanel) { StackPanel stackp = (StackPanel)ChangedFV.Items[ChangedFV.Items.Count - 1]; if (returnSize(stackp).Height < SizeElement.Height - 300) { stackp.Children.Add(temp); } else { ChangedFV.Items.Add(addStack(temp)); } } //FormulCase temp = new FormulCase(formTemp.description, formTemp.uriImage, formTemp.addF, formTemp.Id); //temp.Width = SizeElement.Width - 90; }
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"); }