public void Edit(ITheoryElement element, int theoryindex, string formulation, string template, string proof) { ITheoryElement elementToEdit = tree.Search(element); elementToEdit.Theoryindex = theoryindex; elementToEdit.Formulation = formulation; elementToEdit.Template = template; if (elementToEdit is Theorem) ((Theorem)elementToEdit).Proof = proof; }
public ElementWindow(ITheoryElement element, List<ITheoryElement> basis, Core.Session session, Core.TheoryTree tree) { InitializeComponent(); CreateElementPanel panel = new CreateElementPanel(element, basis, session, tree); panel.Accepted += new Protsenko.TheoryEditor.Core.Events.Accepted(panel_Accepted); this.Name = "createElement"; LanguageResource_Updated(""); this.Content = panel; LanguageResource.Updated += new Protsenko.TheoryEditor.Core.Events.Updated(LanguageResource_Updated); this.ShowDialog(); }
public TheoryVisualElement(ITheoryElement element) { InitializeComponent(); this.element = element; Title.Text = element.GetTheoryType().ToString(); formulation.Text = element.Formulation; element.Updated += new Protsenko.TheoryEditor.Core.Events.Updated(element_Updated); LanguageResource.Updated +=new Protsenko.TheoryEditor.Core.Events.Updated(LanguageResource_Updated); element_Updated(element); LanguageResource_Updated(null); }
public static string MakeFormattedText(ITheoryElement element) { StringBuilder strBuilder = new StringBuilder(); strBuilder.AppendLine(LanguageResource.currentDictionary[element.GetTheoryType().ToString()]); strBuilder.AppendLine(" " + element.Formulation.Replace("\n", "\n ")); if (element is Theorem) { strBuilder.AppendLine(LanguageResource.currentDictionary["proof"]); strBuilder.AppendLine(" " + ((Theorem)element).Proof.Replace("\n", "\n ")); } strBuilder.AppendLine(); return strBuilder.ToString(); }
public CreateElementPanel(ITheoryElement element, List<ITheoryElement> basis, Core.Session session, TheoryTree tree) { InitializeComponent(); this.element = element; this.basis = basis; this.currentSession = session; this.type = element.GetTheoryType(); this.tree = tree; TheoryTypeBox.Text = type.ToString(); LinksItemBox.ItemsSource = basis; FormulationTextBox.Text = element.Formulation; TemplateTextBox.Text = element.Template; if (element is Theorem) ProofTextBox.Text = ((Theorem)element).Proof; mod = Mods.Edit; LanguageResource.Updated += new Updated(LanguageResource_Updated); Update(); LanguageResource_Updated(null); }
public void EditTheoryElement(ITheoryElement element, int theoryindex, string formulation, string template, string proof) { try { treeController.Edit(element, theoryindex, formulation, template, proof); } catch (Exception e) { exceptionHandler.Add(e); } }
public void Edit(ITheoryElement element,int theoryindex, string formulation, string template, string proof, List<ITheoryElement> newbasis) { ITheoryElement elementToEdit = tree.Search(element); elementToEdit.Theoryindex = theoryindex; elementToEdit.Formulation = formulation; elementToEdit.Template = template; if (elementToEdit is Theorem) ((Theorem)elementToEdit).Proof = proof; if (newbasis != null) tree.SetBasis(elementToEdit,newbasis); }
public void Delete(ITheoryElement element) { tree.Remove(element); }
public void Add(ITheoryElement element, List<ITheoryElement> newbasis) { tree.Add(element, newbasis); }
public void Add(ITheoryElement element) { tree.Add(element); }
public static UIElement MakeVisual(ITheoryElement implementation) { return new TheoryVisualElement(implementation); }
public EVisualInfo GetVisualInfo(ITheoryElement element) { TheoryVisualDecorator dec; for (int i = 0; i < collection.Count; i++) { dec = (TheoryVisualDecorator)collection[i]; if (dec.GetTheoryElement() == element) { return dec.GetVisualInformation(); } } return null; }
private void tree_ContentDeleted(ITheoryElement element) { try { int ind = -1; TheoryVisualDecorator dec; for (int i = 0; i < Children.Count; i++) { dec = (TheoryVisualDecorator)Children[i]; if (dec.GetTheoryElement() == element) { ind = i; break; } } this.Children.RemoveAt(ind); changed = true; } finally { } }
private void tree_ContentAdded(ITheoryElement element) { TheoryVisualDecorator decorator = TheoryVisualDecorator.СreateInstance(InfromationPresenter.MakeVisual(element), element.Theoryindex.ToString() + " " + (Children.Count + 1)); decorator.DragStart += new DragStart(obj_DragStart); decorator.DragEnd += new DragEnd(obj_DragEnd); decorator.Focused += new Focused(obj_Focused); decorator.MouseLeftButtonDown += new MouseButtonEventHandler(dragpanel_MouseLeftButtonDown); decorator.WantsToBeEdited += new Protsenko.TheoryEditor.Core.Events.Updated(decorator_WantsToBeEdited); this.Children.Add(decorator); changed = true; }
private TheoryVisualDecorator Search(ITheoryElement element) { foreach(TheoryVisualDecorator dec in Children) { if (dec.GetTheoryElement() == element) return dec; } return null; }