private void okCancelButton_ButtonClick(object aSender, EventArgs aEventArgs) { if (okCancelButton.DialogResult == DialogResult.Cancel) { DialogResult = DialogResult.Cancel; } else { try { mCSharpFSMClone.check(); mCSharpFSM.clearAllStates(); mCSharpFSM.clone(mCSharpFSMClone); mCSharpFSMClone = null; DialogResult = DialogResult.OK; } catch (Exception lExc) { MessageForm.showMessage(lExc.Message, this); } } }
protected override void Dispose(bool disposing) { if (disposing) { if (mGViewer != null) { mGViewer.MouseClick -= MGViewer_MouseClick; mGViewer.ObjectUnderMouseCursorChanged -= MGViewer_ObjectUnderMouseCursorChanged; mGViewer.Dispose(); mGViewer = null; } if (mCSharpFSMClone != null) { mCSharpFSMClone.Dispose(); mCSharpFSMClone = null; } if (components != null) { components.Dispose(); } } base.Dispose(disposing); }
public void clone(CSharpFSM aCSharpFSM) { using (var lStream = new MemoryStream()) { var lXMLTextWriter = new XmlTextWriter(lStream, Encoding.UTF8); lXMLTextWriter.WriteStartElement("Properties"); aCSharpFSM.saveToXML(lXMLTextWriter); lXMLTextWriter.WriteEndElement(); lXMLTextWriter.Flush(); lStream.Position = 0; var lXMLTextReader = new XmlTextReader(lStream); lXMLTextReader.Read(); loadFromXML(lXMLTextReader); } }
public SetupForm(CSharpFSM aCSharpFSM, IItemBrowser aBrowser) { mCSharpFSM = aCSharpFSM; mBrowser = aBrowser; mCSharpFSMClone = new CSharpFSM(); mCSharpFSMClone.ItemBrowser = mBrowser; mCSharpFSMClone.clone(mCSharpFSM); InitializeComponent(); mGViewer = new GViewer(); mGViewer.Dock = DockStyle.Fill; mGViewer.ToolBarIsVisible = false; mGViewer.ObjectUnderMouseCursorChanged += MGViewer_ObjectUnderMouseCursorChanged; mGViewer.MouseClick += MGViewer_MouseClick; panel_Graph.Controls.Add(mGViewer); updateForm(); updateButtons(); }