public EIBNode() { EIBNodeConnector nodeConnector = new EIBNodeConnector(); nodeConnector.AssociateMarkUpandDown(this); isMouseUp = true; nodeConnector.baseFrame = UIEventManager.form.currentBaseWindow.baseFrame; }
private void Done_Click(object sender, EventArgs e) { if (this.eibRelation1.relationName.Text.Trim().Equals("")) { this.eibRelation1.errorLabel.Text = "RelationShip Name can not be empty"; return; } if (this.eibRelation1.firstTableName.SelectedItem == null) { this.eibRelation1.errorLabel.Text = "Select First Node"; return; } if (this.eibRelation1.secondTableName.SelectedItem == null) { this.eibRelation1.errorLabel.Text = "Select Second Node"; return; } try { EIBNodeConnector nodeConnector = new EIBNodeConnector(); nodeConnector.Name = this.eibRelation1.relationName.Text; nodeConnector.InitiateSettings(panelControl); nodeConnector.Mark1 = (EIBNode)currentBaseWindow.WorkflowNodes[this.eibRelation1.firstTableName.SelectedItem.ToString()]; nodeConnector.Mark2 = (EIBNode)currentBaseWindow.WorkflowNodes[this.eibRelation1.secondTableName.SelectedItem.ToString()]; nodeConnector.createLine(); panelControl.Controls.Add(nodeConnector); FormDesigner.eventManager.addPropertiesControl(nodeConnector.CenterMark); } catch (Exception ex) { this.eibRelation1.errorLabel.Text = ex.Message; } this.Close(); }
public static void saveXMLofNodeConnector(Control nodeControl) { if (nodeControl != null) { EIBNodeConnector nodeEIB = (EIBNodeConnector)nodeControl; EIBNode fromNode = nodeEIB.Mark1; EIBNode toNode = nodeEIB.Mark2; //Save workflow Node Hashtable controlProperties = new Hashtable(); XmlNode xmlNode = XMLServices.writeElement(nodeEIB.ParentXmlNode, nodeEIB.ControlType, controlProperties, null, null); XmlAttribute connectorNameAtt = xmlNode.OwnerDocument.CreateAttribute(XMLServicesConstants.XmlNodeNameAtt); connectorNameAtt.Value = nodeEIB.ControlName; xmlNode.Attributes.Append(connectorNameAtt); //Save from node Pattern controlProperties.Clear(); controlProperties.Add(XMLServicesConstants.XmlNodeIdAtt, fromNode.WorkFlowNode.WorkFlowNodeId); XMLServices.writeElement(xmlNode, "from", controlProperties, null, null); //Save from node Pattern controlProperties.Clear(); controlProperties.Add(XMLServicesConstants.XmlNodeIdAtt, toNode.WorkFlowNode.WorkFlowNodeId); XMLServices.writeElement(xmlNode, "to", controlProperties, null, null); } }
public EIBNode() { EIBNodeConnector nodeConnector = new EIBNodeConnector(); nodeConnector.AssociateMarkUpandDown(this); isMouseUp = true; nodeConnector.baseFrame = UIEventManager.form.currentBaseWindow.baseFrame; }
private void Done_Click(object sender, EventArgs e) { if (this.eibRelation1.relationName.Text.Trim().Equals("")) { this.eibRelation1.errorLabel.Text = "RelationShip Name can not be empty"; return; } if (this.eibRelation1.firstTableName.SelectedItem == null ) { this.eibRelation1.errorLabel.Text = "Select First Node"; return; } if (this.eibRelation1.secondTableName.SelectedItem == null) { this.eibRelation1.errorLabel.Text = "Select Second Node"; return; } try { EIBNodeConnector nodeConnector = new EIBNodeConnector(); nodeConnector.Name = this.eibRelation1.relationName.Text; nodeConnector.InitiateSettings(panelControl); nodeConnector.Mark1 = (EIBNode)currentBaseWindow.WorkflowNodes[this.eibRelation1.firstTableName.SelectedItem.ToString()]; nodeConnector.Mark2 = (EIBNode)currentBaseWindow.WorkflowNodes[this.eibRelation1.secondTableName.SelectedItem.ToString()]; nodeConnector.createLine(); panelControl.Controls.Add(nodeConnector); FormDesigner.eventManager.addPropertiesControl(nodeConnector.CenterMark); } catch (Exception ex) { this.eibRelation1.errorLabel.Text = ex.Message; } this.Close(); }
//Deserialize individual base windows and there child control public static void DeserializeWindowXML(string fileName, Control baseFrame, XmlNode parentXMLNode) { DataSet dataset = new DataSet(); XmlDocument doc = new XmlDocument(); XmlNode currentXmlNode = null; Dictionary<string, EIBNode> listNode = new Dictionary<string, EIBNode>(); try { // disabling re-drawing of treeview till all nodes are added baseFrame.SuspendLayout(); fileName = fileName + ".xml"; if (parentXMLNode == null) { doc.Load(fileName); currentXmlNode = doc.FirstChild; } else { currentXmlNode = parentXMLNode; } baseFrame.Controls.Clear(); if (currentXmlNode.Name == FormDesignerConstants.BaseWindow) { // loading node attributes UpdateControlProperties(baseFrame, currentXmlNode); } //Iterate all nodes foreach (XmlNode xmlNode in currentXmlNode.ChildNodes) { if (xmlNode.NodeType == XmlNodeType.Element) { if (xmlNode.Name == FormDesignerConstants.NodeControl) { EIBNode.counter++; EIBNode eibNode = new EIBNode(); UpdateControlProperties(eibNode, xmlNode); eibNode.nodeIdText.Text = xmlNode.Attributes["id"].Value.ToString(); eibNode.startNodeCheck.Checked = (xmlNode.Attributes["isstart"].Value.ToLower().Equals("true")); // baseFrame.Controls.Add(eibNode); listNode.Add(eibNode.nodeIdText.Text, eibNode); //EIBNode newNode = new EIBNode(); // UpdateControlProperties(newNode, xmlNode); // newNode.nodeIdText.Text = xmlNode["workflownode"].Attributes["id"].Value.ToString(); // newNode.startNodeCheck.Checked = (xmlNode["workflownode"].Attributes["isstart"].Value.ToLower().Equals("true")); //XmlNode xmlWorkFlowNode = getXMLNodeWithName(xmlNode,"workflownode") //xmlNode[ eibNode.WorkFlowNode= Desearializeworkflownodexml(xmlNode); eibNode.workflowNode.WorkFlowNodeId = eibNode.nodeIdText.Text; eibNode.nodeIdText.Enabled = false; ((BaseWindow)baseFrame.Parent).WorkflowNodes.Add(eibNode.workflowNode.WorkFlowNodeId, eibNode); baseFrame.Controls.Add(eibNode); } if (xmlNode.Name == "connector") { try { //EIBNodeConnector.counter++; EIBNodeConnector newNode = new EIBNodeConnector(); XmlNode xmlNodeconnector = xmlNode; UpdateControlProperties(newNode, xmlNodeconnector); XmlNode connectorNode = xmlNodeconnector; //XmlNode fromNodeName = connectorNode["from"].Attributes["id"]; //XmlNode toNodeName = connectorNode["to"].Attributes["id"]; string fromNodeName = connectorNode["from"].Attributes["id"].Value; string toNodeName = connectorNode["to"].Attributes["id"].Value; EIBNode fromNode = listNode[fromNodeName]; EIBNode toNode = listNode[toNodeName]; Graphics g = null; Bitmap bmpBack = new Bitmap(baseFrame.Width, baseFrame.Height); Graphics.FromImage(bmpBack).Clear(baseFrame.BackColor); baseFrame.BackgroundImage = (Bitmap)bmpBack.Clone(); g = Graphics.FromImage(baseFrame.BackgroundImage); int centerMarkX = (fromNode.Center.X + toNode.Center.X) / 2; int centerMarkY = (fromNode.Center.Y + toNode.Center.Y) / 2; newNode.centerMark.Location = new Point(centerMarkX - 4, centerMarkY - 4); newNode.InitiateSettings((EIBPanel)baseFrame); newNode.Mark1 = fromNode; newNode.Mark2 = toNode; newNode.createLine(); baseFrame.Controls.Add(newNode.centerMark); g.DrawLine(new Pen(Color.RoyalBlue, (float)2), fromNode.Center.X, fromNode.Center.Y, centerMarkX, centerMarkY); g.DrawLine(new Pen(Color.RoyalBlue, (float)2), toNode.Center.X, toNode.Center.Y, centerMarkX, centerMarkY); baseFrame.Controls.Add(newNode); } catch (Exception ex) { MessageBox.Show("Connector xml Modified."); } } } } //Iterate all nodes connector /*foreach (XmlNode xmlNodeconnector in currentXmlNode.ChildNodes) { if (xmlNodeconnector.NodeType == XmlNodeType.Element) { } }*/ } catch (FileNotFoundException) { MessageBox.Show("Basewindow.xml not Found"); } finally { baseFrame.ResumeLayout(); // enabling redrawing of treeview after all nodes are added baseFrame.Invalidate(); } }
//Deserialize individual base windows and there child control public static void DeserializeWindowXML(string fileName, Control baseFrame, XmlNode parentXMLNode) { DataSet dataset = new DataSet(); XmlDocument doc = new XmlDocument(); XmlNode currentXmlNode = null; Dictionary <string, EIBNode> listNode = new Dictionary <string, EIBNode>(); try { // disabling re-drawing of treeview till all nodes are added baseFrame.SuspendLayout(); fileName = fileName + ".xml"; if (parentXMLNode == null) { doc.Load(fileName); currentXmlNode = doc.FirstChild; } else { currentXmlNode = parentXMLNode; } baseFrame.Controls.Clear(); if (currentXmlNode.Name == FormDesignerConstants.BaseWindow) { // loading node attributes UpdateControlProperties(baseFrame, currentXmlNode); } //Iterate all nodes foreach (XmlNode xmlNode in currentXmlNode.ChildNodes) { if (xmlNode.NodeType == XmlNodeType.Element) { if (xmlNode.Name == FormDesignerConstants.NodeControl) { EIBNode.counter++; EIBNode eibNode = new EIBNode(); UpdateControlProperties(eibNode, xmlNode); eibNode.nodeIdText.Text = xmlNode.Attributes["id"].Value.ToString(); eibNode.startNodeCheck.Checked = (xmlNode.Attributes["isstart"].Value.ToLower().Equals("true")); // baseFrame.Controls.Add(eibNode); listNode.Add(eibNode.nodeIdText.Text, eibNode); //EIBNode newNode = new EIBNode(); // UpdateControlProperties(newNode, xmlNode); // newNode.nodeIdText.Text = xmlNode["workflownode"].Attributes["id"].Value.ToString(); // newNode.startNodeCheck.Checked = (xmlNode["workflownode"].Attributes["isstart"].Value.ToLower().Equals("true")); //XmlNode xmlWorkFlowNode = getXMLNodeWithName(xmlNode,"workflownode") //xmlNode[ eibNode.WorkFlowNode = Desearializeworkflownodexml(xmlNode); eibNode.workflowNode.WorkFlowNodeId = eibNode.nodeIdText.Text; eibNode.nodeIdText.Enabled = false; ((BaseWindow)baseFrame.Parent).WorkflowNodes.Add(eibNode.workflowNode.WorkFlowNodeId, eibNode); baseFrame.Controls.Add(eibNode); } if (xmlNode.Name == "connector") { try { //EIBNodeConnector.counter++; EIBNodeConnector newNode = new EIBNodeConnector(); XmlNode xmlNodeconnector = xmlNode; UpdateControlProperties(newNode, xmlNodeconnector); XmlNode connectorNode = xmlNodeconnector; //XmlNode fromNodeName = connectorNode["from"].Attributes["id"]; //XmlNode toNodeName = connectorNode["to"].Attributes["id"]; string fromNodeName = connectorNode["from"].Attributes["id"].Value; string toNodeName = connectorNode["to"].Attributes["id"].Value; EIBNode fromNode = listNode[fromNodeName]; EIBNode toNode = listNode[toNodeName]; Graphics g = null; Bitmap bmpBack = new Bitmap(baseFrame.Width, baseFrame.Height); Graphics.FromImage(bmpBack).Clear(baseFrame.BackColor); baseFrame.BackgroundImage = (Bitmap)bmpBack.Clone(); g = Graphics.FromImage(baseFrame.BackgroundImage); int centerMarkX = (fromNode.Center.X + toNode.Center.X) / 2; int centerMarkY = (fromNode.Center.Y + toNode.Center.Y) / 2; newNode.centerMark.Location = new Point(centerMarkX - 4, centerMarkY - 4); newNode.InitiateSettings((EIBPanel)baseFrame); newNode.Mark1 = fromNode; newNode.Mark2 = toNode; newNode.createLine(); baseFrame.Controls.Add(newNode.centerMark); g.DrawLine(new Pen(Color.RoyalBlue, (float)2), fromNode.Center.X, fromNode.Center.Y, centerMarkX, centerMarkY); g.DrawLine(new Pen(Color.RoyalBlue, (float)2), toNode.Center.X, toNode.Center.Y, centerMarkX, centerMarkY); baseFrame.Controls.Add(newNode); } catch (Exception ex) { MessageBox.Show("Connector xml Modified."); } } } } //Iterate all nodes connector /*foreach (XmlNode xmlNodeconnector in currentXmlNode.ChildNodes) * { * if (xmlNodeconnector.NodeType == XmlNodeType.Element) * { * * } * }*/ } catch (FileNotFoundException) { MessageBox.Show("Basewindow.xml not Found"); } finally { baseFrame.ResumeLayout(); // enabling redrawing of treeview after all nodes are added baseFrame.Invalidate(); } }