public ProgramInPort CreateInport() { if (_entity != null && _entity.ProgEntity != null && _entity.CanAddInputs) { IDataSelectionControl dlg = MathNode.GetPropertySelector( XmlSerialization.GetProjectGuid(_xmlNode.OwnerDocument), XmlSerialization.GetRootComponentId(_xmlNode), _entity.ProgEntity.OwnerObject, EnumPropAccessType.CanWrite); if (((Form)dlg).ShowDialog(this.FindForm()) == DialogResult.OK) { ObjectRef v = dlg.UITypeEditorSelectedValue as ObjectRef; if (v != null) { ProgramInPort pp = new ProgramInPort(_entity.ProgEntity); pp.PortProperty = v; //add to collection _entity.ProgEntity.AddInport(pp); //setup this.Parent.Controls.Add(pp); pp.Owner = this; pp.CheckCreatePreviousNode(); this.Parent.Controls.Add((Control)pp.PrevNode); pp.CreateBackwardLine(); pp.Label.Text = v.localName; ((MathNodeVariable)(((DrawingVariable)(pp.Label)).Variable.MathExpression[0])).VariableName = v.localName; return(pp); } } } return(null); }