private void addIcon(pin pin) { PictureBox thisPinBox = new PictureBox(); thisPinBox.Image = Resources.ArrowRight; thisPinBox.Size = thisPinBox.Image.Size; thisPinBox.Cursor = Cursors.Hand; thisPinBox.BackColor = Color.Transparent; thisPinBox.MouseMove += new MouseEventHandler(this.thisPinBox_MouseMove); ToolTip tt = new ToolTip(); tt.SetToolTip(thisPinBox, pin.description); this.conPins.Add(pin, thisPinBox); thisPinBox.Tag = pin; pin.imageBox = thisPinBox; this.Controls.Add(thisPinBox); }
public void connectTo(lineChainGuid newTargetChain, pin newTargetPin) { parentLineChain.id = newTargetChain.id; linkedTo.id = newTargetPin.serial.id; // Only wire up events on input pins, since data progresses from outputs to inputs. if (newTargetPin.direction == pinDirection.input) { if (newTargetPin.dynamic) { newTargetPin.valueType = valueType; newTargetPin.recreateValue(); } OnPinChange += newTargetPin.stateChanged; } }
public void stateChanged(pin changed, EventArgs e) { value.data = changed.value.data; }
private Dictionary<string, pin> readPinDictionaryInToRule(XmlReader reader) { String parentTag = reader.Name.ToLower(); Dictionary<string,pin> pinInfo = new Dictionary<string , pin>(); pin thisPin = new pin(); bool keepGoing = true; bool inhibitNextRead; while (keepGoing) { inhibitNextRead = false; String xmlName = reader.Name.ToLower(); if (xmlName == parentTag && reader.NodeType == XmlNodeType.EndElement) keepGoing = false; if (xmlName == "serial" && reader.NodeType == XmlNodeType.Element) { thisPin.serial = new pinGuid(reader.ReadElementContentAsString()); inhibitNextRead = true; } if (xmlName == "linkedto" && reader.NodeType == XmlNodeType.Element) { thisPin.linkedTo = new pinGuid(reader.ReadElementContentAsString()); inhibitNextRead = true; } if (xmlName == "parentlinechain" && reader.NodeType == XmlNodeType.Element) { thisPin.parentLineChain = new lineChainGuid(reader.ReadElementContentAsString()); inhibitNextRead = true; } if (xmlName == "description" && reader.NodeType == XmlNodeType.Element) { thisPin.description = reader.ReadElementContentAsString(); inhibitNextRead = true; } if (xmlName == "name" && reader.NodeType == XmlNodeType.Element) { thisPin.name = reader.ReadElementContentAsString(); inhibitNextRead = true; } if (xmlName == "direction" && reader.NodeType == XmlNodeType.Element) { thisPin.direction = (pinDirection)Enum.Parse(typeof(pinDirection), reader.ReadElementContentAsString(), true); inhibitNextRead = true; } if (xmlName == "datatype" && reader.NodeType == XmlNodeType.Element) { thisPin.valueType = Type.GetType(reader.ReadElementContentAsString()); inhibitNextRead = true; } if (xmlName == "pin" && reader.NodeType == XmlNodeType.EndElement) { pinInfo.Add(thisPin.name,thisPin); thisPin = new pin(); } if (keepGoing && !inhibitNextRead) keepGoing = reader.Read(); } return pinInfo; }