Esempio n. 1
0
        public void Disconnect(dynPort p)
        {
            if (p.Equals(pStart))
            {
                //pStart.Owner.Outputs[pStart.Index] = null;
                pStart = null;
            }

            if (p.Equals(pEnd))
            {
                if (pEnd.PortType == PortType.INPUT)
                {
                    pEnd.Owner.InPortData[pEnd.Index].Object = null;
                }
                else if (pEnd.PortType == PortType.STATE)
                {
                    pEnd.Owner.StatePortData[pEnd.Index].Object = null;
                }
                pEnd = null;
            }

            p.Disconnect(this);

            //turn the connector back to dashed
            connector.StrokeDashArray.Add(5);
            connector.StrokeDashArray.Add(2);
        }
Esempio n. 2
0
        public bool Connect(dynPort p)
        {
            //test if the port that you are connecting too is not the start port or the end port
            //of the current connector
            if (p.Equals(pStart) || p.Equals(pEnd))
            {
                return(false);
            }

            //if the selected connector is also an output connector, return false
            //output ports can't be connected to eachother
            if (p.PortType == PortType.OUTPUT)
            {
                return(false);
            }

            //test if the port that you are connecting to is an input and
            //already has other connectors
            if (p.PortType == PortType.INPUT && p.Connectors.Count > 0)
            {
                return(false);
            }

            //test if the port element at B can connect to the port at A
            //test if you can convert the element at A to the element at b
            if (p.PortType == PortType.INPUT)
            {
                if (!p.Owner.InPortData[p.Index].PortType.IsAssignableFrom(pStart.Owner.OutPortData[pStart.Index].PortType))
                {
                    return(false);
                }
            }
            else if (p.PortType == PortType.STATE)
            {
                if (!p.Owner.StatePortData[p.Index].PortType.IsAssignableFrom(pStart.Owner.OutPortData[pStart.Index].PortType))
                {
                    return(false);
                }
            }

            //turn the line solid
            connector.StrokeDashArray.Clear();

            pEnd = p;

            if (pEnd != null)
            {
                //set the start and end values to equal so this
                //starts evaulating immediately
                pEnd.Owner.InPortData[p.Index].Object = pStart.Owner.OutPortData[pStart.Index].Object;
                p.Connect(this);
                pEnd.Update();
                pEnd.Owner.Update();
            }

            return(true);
        }
Esempio n. 3
0
        public void Disconnect(dynPort p)
        {
            if (p.Equals(pStart))
            {
                pStart = null;
            }

            if (p.Equals(pEnd))
            {
                pEnd = null;
            }

            p.Disconnect(this);

            //turn the connector back to dashed
            connector.StrokeDashArray.Add(5);
            connector.StrokeDashArray.Add(2);

            plineConnector.StrokeDashArray.Add(5);
            plineConnector.StrokeDashArray.Add(2);
        }
Esempio n. 4
0
        public bool Connect(dynPort p)
        {
            //test if the port that you are connecting too is not the start port or the end port
            //of the current connector
            if (p.Equals(pStart) || p.Equals(pEnd))
            {
                return false;
            }

            //if the selected connector is also an output connector, return false
            //output ports can't be connected to eachother
            if (p.PortType == PortType.OUTPUT)
            {
                return false;
            }

            //test if the port that you are connecting to is an input and
            //already has other connectors
            if (p.PortType == PortType.INPUT && p.Connectors.Count > 0)
            {
                return false;
            }

            //turn the line solid
            connector.StrokeDashArray.Clear();
            plineConnector.StrokeDashArray.Clear();
            pEnd = p;

            if (pEnd != null)
            {
                //set the start and end values to equal so this
                //starts evaulating immediately
                //pEnd.Owner.InPortData[p.Index].Object = pStart.Owner.OutPortData.Object;
                p.Connect(this);
                pEnd.Update();
            }

            return true;
        }
Esempio n. 5
0
        public void Disconnect(dynPort p)
        {
            if (p.Equals(pStart))
            {
                //pStart.Owner.Outputs[pStart.Index] = null;
                pStart = null;
            }

            if (p.Equals(pEnd))
            {
                if(pEnd.PortType == PortType.INPUT)
                    pEnd.Owner.InPortData[pEnd.Index].Object = null;
                else if(pEnd.PortType == PortType.STATE)
                    pEnd.Owner.StatePortData[pEnd.Index].Object = null;
                pEnd = null;
            }

            p.Disconnect(this);

            //turn the connector back to dashed
            connector.StrokeDashArray.Add(5);
            connector.StrokeDashArray.Add(2);
        }