public void LoadGroup(MathExpGroup mathGroup) { bool b = _disableUndo; _disableUndo = true; ClearComponents(); // IDesignServiceProvider sp = MathNode.GetGlobalServiceProvider(mathGroup); if (sp != null) { MathNode.RegisterGetGlobalServiceProvider(root, sp); } root.LoadGroup(mathGroup); designview_Resize(null, null); // picIcomImage.Size = mathGroup.IconImage.IconSize; picIcomImage.Image = mathGroup.CreateIcon(root.CreateGraphics()); enablePaste(); root.Changed = false; bLoading = false; root.Refresh(); _disableUndo = b; result = mathGroup; }
private void loadIconImage() { MathExpGroup mathExpGroup = root.Export(); picIcomImage.Size = mathExpGroup.IconImage.IconSize; picIcomImage.Image = mathExpGroup.CreateIcon(root.CreateGraphics()); }
private void btTest_Click(object sender, EventArgs e) { btTest.Enabled = false; try { _testData = null; //generate the result result = root.Export(); // //check if compilation is needed IObjectTypeUnitTester uc = (IObjectTypeUnitTester)MathNode.GetService(typeof(IObjectTypeUnitTester)); if (uc != null) { _testData = uc.UseMemberTest(this); } if (_testData == null) { CompileResult compiled = result.CreateMethodCompilerUnit("TestMathExpression", "Test", "TestMathExpGroup"); // thTest = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(test)); thTest.SetApartmentState(System.Threading.ApartmentState.STA); _testData = new TestData(compiled); thTest.Start(_testData); } // timer1.Enabled = true; } catch (Exception err) { MathNode.Log(this.FindForm(), err); } }
public void OnOK() { result = root.Export(); root.Changed = false; Form f = FindForm(); f.DialogResult = DialogResult.OK; }
private void copyToClipboard() { if (selectionService.PrimarySelection != null) { MathExpViewer mv = selectionService.PrimarySelection as MathExpViewer; if (mv != null) { MathExpGroup mg = new MathExpGroup(); MathExpItem mi = mv.ExportMathItem(mg); XmlDocument doc = new XmlDocument(); XmlNode node = doc.CreateElement("MathExpression"); doc.AppendChild(node); mi.SaveToXmlNode(_writer, node); Clipboard.SetData("MathItem", doc.OuterXml); enablePaste(); } } }
public void PasteFromClipboard() { if (Clipboard.ContainsData("MathItem")) { object data = Clipboard.GetData("MathItem"); if (data != null) { string s = data.ToString(); XmlDocument doc = new XmlDocument(); doc.LoadXml(s); if (doc.DocumentElement != null) { try { CreateUndoTransaction("PasteFromClipboard"); MathExpGroup mg = new MathExpGroup(); MathExpItem mi = new MathExpItem(mg); mi.ReadFromXmlNode(_reader, doc.DocumentElement); mi.Name = CreateName(XmlSerialization.XML_Math); mi.Location = new Point(mi.Location.X + 5, mi.Location.Y + 5); //re-arrange the ports mi.ReCreateDefaultPorts(); this.LoadMathItem(mi); //create controls, same as DiagramViewer.LoadGroup root.Controls.AddRange(mi.GetPortControls()); mi.CreateLinkLines(); CommitUndoTransaction("PasteFromClipboard"); } catch (Exception err) { MessageBox.Show(err.Message); RollbackUndoTransaction("PasteFromClipboard"); } } } } }
public void Apply(MathExpGroup item) { bLoading = true; this.LoadGroup(item); bLoading = false; }
public MathExpGroupUndo(DiagramDesignerHolder holder, MathExpGroup g) { _holder = holder; _group = g; }