public VisualCondition Clone() { VisualCondition vf = new VisualCondition(this.functionXml.Clone() as XmlNode); vf.Data = this.Data.Clone(); return vf; }
private void loadFunctionsToolbox(string functionsFile, Toolbox fToolbox) { //something should be done for templte repository if (System.IO.File.Exists(functionsFile)) { try { XmlReaderSettings readerSettings = new XmlReaderSettings(); readerSettings.IgnoreComments = true; using (XmlReader reader = XmlReader.Create(functionsFile, readerSettings)) { // SECTION 1. Create a DOM Document and load the XML data into it. fdom = new XmlDocument(); fdom.Load(reader); // SECTION 2. Initialize Elements XmlNodeList arfunctions = fdom.SelectNodes("Functions/Arithmetic/Function"); XmlNodeList reffunctions = fdom.SelectNodes("Functions/Reference/Condition"); //MessageBox.Show(customNodes.Count.ToString()); // SECTION 3. Populate Items with the DOM nodes. foreach (XmlNode func in arfunctions) { VisualFunction f = new VisualFunction(func); ToolboxItem item = new ToolboxItem(f); //item.Content = f; //item.loadFunctionToolBoxItem(func); fToolbox.Items.Add(item); } foreach (XmlNode func in reffunctions) { VisualCondition f = new VisualCondition(func); ToolboxItem item = new ToolboxItem(f); //item.Content = f; //item.loadFunctionToolBoxItem(func); fToolbox.Items.Add(item); } reader.Close(); } } catch (XmlException xmlEx) { reportMessage(xmlEx.Message, ReportIcon.Error); } catch (Exception ex) { reportMessage(ex.Message, ReportIcon.Error); } } else reportMessage("Could not load Function ToolboxItems file : " + functionsFile, ReportIcon.Error); }