public ProgramOutPort CreateOutport()
 {
     if (_entity != null && _entity.ProgEntity != null && _entity.CanAddOutputs)
     {
         IDataSelectionControl dlg = MathNode.GetPropertySelector(
             XmlSerialization.GetProjectGuid(_xmlNode.OwnerDocument),
             XmlSerialization.GetRootComponentId(_xmlNode),
             _entity.ProgEntity.OwnerObject,
             EnumPropAccessType.CanRead);
         if (((Form)dlg).ShowDialog(this.FindForm()) == DialogResult.OK)
         {
             ObjectRef v = dlg.UITypeEditorSelectedValue as ObjectRef;
             if (v != null)
             {
                 ProgramOutPort pp = new ProgramOutPort(_entity.ProgEntity);
                 pp.PortProperty = v;
                 //add to collection
                 _entity.ProgEntity.AddOutport(pp);
                 //setup
                 this.Parent.Controls.Add(pp);
                 pp.Owner = this;
                 pp.CheckCreateNextNode();
                 this.Parent.Controls.Add((Control)pp.NextNode);
                 pp.CreateForwardLine();
                 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 RemoveOutport(UInt32 id)
 {
     if (_outports != null)
     {
         for (int i = 0; i < _outports.Length; i++)
         {
             if (_outports[i].PortID == id)
             {
                 if (_outports.Length == 1)
                 {
                     _outports = null;
                 }
                 else
                 {
                     ProgramOutPort[] a = new ProgramOutPort[_outports.Length - 1];
                     for (int k = 0; k < _outports.Length; k++)
                     {
                         if (k < i)
                         {
                             a[k] = _outports[k];
                         }
                         else if (k > i)
                         {
                             a[k - 1] = _outports[k];
                         }
                     }
                     _outports = a;
                 }
                 break;
             }
         }
     }
 }
Ejemplo n.º 3
0
        public override object Clone()
        {
            ProgramOutPort obj = (ProgramOutPort)base.Clone();

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

            if (_outports == null)
            {
                _outports = new ProgramOutPort[1];
                n         = 0;
            }
            else
            {
                n = _outports.Length;
                ProgramOutPort[] a = new ProgramOutPort[n + 1];
                for (int i = 0; i < n; i++)
                {
                    a[i] = _outports[i];
                }
                _outports = a;
            }
            _outports[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);
        }