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);
 }
Ejemplo n.º 2
0
 public void RemoveInport(int id)
 {
     if (_inports != null)
     {
         for (int i = 0; i < _inports.Length; i++)
         {
             if (_inports[i].PortID == id)
             {
                 if (_inports.Length == 1)
                 {
                     _inports = null;
                 }
                 else
                 {
                     ProgramInPort[] a = new ProgramInPort[_inports.Length - 1];
                     for (int k = 0; k < _inports.Length; k++)
                     {
                         if (k < i)
                         {
                             a[k] = _inports[k];
                         }
                         else if (k > i)
                         {
                             a[k - 1] = _inports[k];
                         }
                     }
                     _inports = a;
                 }
                 break;
             }
         }
     }
 }
Ejemplo n.º 3
0
        public override object Clone()
        {
            ProgramInPort obj = (ProgramInPort)base.Clone();

            if (_property != null)
            {
                obj.PortProperty = (ObjectRef)_property.Clone();
            }
            obj.DataFlowType = this.DataFlowType;
            return(obj);
        }
Ejemplo n.º 4
0
        public void AddInport(ProgramInPort p)
        {
            int n;

            if (_inports == null)
            {
                _inports = new ProgramInPort[1];
                n        = 0;
            }
            else
            {
                n = _inports.Length;
                ProgramInPort[] a = new ProgramInPort[n + 1];
                for (int i = 0; i < n; i++)
                {
                    a[i] = _inports[i];
                }
                _inports = a;
            }
            _inports[n] = p;
        }
Ejemplo n.º 5
0
        public object Clone()
        {
            ProgramEntity obj = new ProgramEntity(
                (ObjectRef)_owner.Clone());

            if (_inports != null)
            {
                ProgramInPort[] a = new ProgramInPort[_inports.Length];
                for (int i = 0; i < _inports.Length; i++)
                {
                    _inports[i].ConstructorParameters = new object[] { obj };
                    a[i] = (ProgramInPort)_inports[i].Clone();
                }
                obj.Inports = a;
            }
            if (_outports != null)
            {
                ProgramOutPort[] a = new ProgramOutPort[_outports.Length];
                for (int i = 0; i < _outports.Length; i++)
                {
                    _outports[i].ConstructorParameters = new object[] { obj };
                    a[i] = (ProgramOutPort)_outports[i].Clone();
                }
                obj.Outports = a;
            }
            if (_newInport != null)
            {
                _newInport.ConstructorParameters = new object[] { obj };
                obj.NewInport = (LinkLineNodeInPort)_newInport.Clone();
            }
            if (_newOutport != null)
            {
                _newOutport.ConstructorParameters = new object[] { obj };
                obj.NewOutport = (LinkLineNodeOutPort)_newOutport.Clone();
            }
            return(obj);
        }