private void save_pin_Click(object sender, EventArgs e) { if (pin_in_node.SelectedIndex == -1 || pin_out_param.Text == "" || pin_in_param.Text == "") { MessageBox.Show("Please complete all information for the link before saving!", "Incomplete information.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } CathodeNodeLink newNodeLink = new CathodeNodeLink(); newNodeLink.connectionID = Utilities.GenerateGUID(DateTime.Now.ToString("G")); newNodeLink.parentParamID = Utilities.GenerateGUID(pin_out_param.Text); newNodeLink.childID = _entityList[pin_in_node.SelectedIndex].nodeID; newNodeLink.childParamID = Utilities.GenerateGUID(pin_in_param.Text); _entity.childLinks.Add(newNodeLink); this.Close(); }
/* Duplicate selected entity */ private void duplicateSelectedNode_Click(object sender, EventArgs e) { if (CurrentInstance.selectedEntity == null) { return; } if (!ConfirmAction("Are you sure you want to duplicate this entity?")) { return; } //Generate new node ID and name CathodeEntity newEnt = Utilities.CloneObject(CurrentInstance.selectedEntity); newEnt.nodeID = Utilities.GenerateGUID(DateTime.Now.ToString("G")); NodeDBEx.AddNewNodeName(newEnt.nodeID, NodeDBEx.GetEntityName(CurrentInstance.selectedEntity.nodeID) + "_clone"); //Add parent links in to this node that linked in to the other node List <CathodeEntity> ents = CurrentInstance.selectedFlowgraph.GetEntities(); List <CathodeNodeLink> newLinks = new List <CathodeNodeLink>(); int num_of_new_things = 1; foreach (CathodeEntity entity in ents) { newLinks.Clear(); foreach (CathodeNodeLink link in entity.childLinks) { if (link.childID == CurrentInstance.selectedEntity.nodeID) { CathodeNodeLink newLink = new CathodeNodeLink(); newLink.connectionID = Utilities.GenerateGUID(DateTime.Now.ToString("G") + num_of_new_things.ToString()); num_of_new_things++; newLink.childID = newEnt.nodeID; newLink.childParamID = link.childParamID; newLink.parentParamID = link.parentParamID; newLinks.Add(newLink); } } if (newLinks.Count != 0) { entity.childLinks.AddRange(newLinks); } } //Save back to flowgraph switch (newEnt.variant) { case EntityVariant.FUNCTION: CurrentInstance.selectedFlowgraph.functions.Add((FunctionEntity)newEnt); break; case EntityVariant.DATATYPE: CurrentInstance.selectedFlowgraph.datatypes.Add((DatatypeEntity)newEnt); break; case EntityVariant.PROXY: CurrentInstance.selectedFlowgraph.proxies.Add((ProxyEntity)newEnt); break; case EntityVariant.OVERRIDE: CurrentInstance.selectedFlowgraph.overrides.Add((OverrideEntity)newEnt); break; case EntityVariant.NOT_SETUP: CurrentInstance.selectedFlowgraph.unknowns.Add(newEnt); break; } //Load in to UI ReloadUIForNewEntity(newEnt); }