Beispiel #1
0
        public static void CreateObjectConnector(VirtualControl host, ObjectPort x, ObjectPort y, string connID = "",
                                                 bool nullifyTempConn = true)
        {
            if (!y.MultipleConnectionsAllowed)
            {
                if (y.ConnectedConnectors.Count > 0)
                {
                    y.ConnectedConnectors.ClearConnectors();
                    y.Linked = false;
                    if (x != null)
                    {
                        x.Linked = false;
                    }
                }
            }
            Connector conn = x.PortTypes == PortTypes.Output
                ? new ObjectsConnector(host, x, y)
                : new ObjectsConnector(host, y, x);

            conn.EndPort.ConnectedConnectors.Add(conn);
            conn.StartPort.ConnectedConnectors.Add(conn);
            conn.StartPort.CountOutConnectors++;
            conn.EndPort.CountOutConnectors++;
            host.TemObjectPort = null;
            TryCast(ref conn);
            y.Data.Value = x.Data.Value;
            host.ObjectConnectors.Add(conn as ObjectsConnector);
            if (connID != "")
            {
                conn.ID = connID;
            }
        }
Beispiel #2
0
        public static void CreateObjectConnector(VirtualControl host, string xid, int xindex, string yid, int yindex,
                                                 string connID        = "",
                                                 bool nullifyTempConn = true)
        {
            ObjectPort x = null, y = null;

            foreach (var node in host.Nodes)
            {
                if (node.Id == xid)
                {
                    x = node.OutputPorts[xindex];
                }
                else if (node.Id == yid)
                {
                    y = node.InputPorts[yindex];
                }
            }
            if (!y.MultipleConnectionsAllowed)
            {
                if (y.ConnectedConnectors.Count > 0)
                {
                    y.ConnectedConnectors.ClearConnectors();
                    y.Linked = false;
                    if (x != null)
                    {
                        x.Linked = false;
                    }
                }
            }
            Connector conn = x.PortTypes == PortTypes.Output
                ? new ObjectsConnector(host, x, y)
                : new ObjectsConnector(host, y, x);

            conn.EndPort.ConnectedConnectors.Add(conn);
            conn.StartPort.ConnectedConnectors.Add(conn);
            conn.StartPort.CountOutConnectors++;
            conn.EndPort.CountOutConnectors++;
            host.TemObjectPort = null;
            TryCast(ref conn);
            y.Data.Value = x.Data.Value;
            host.ObjectConnectors.Add(conn as ObjectsConnector);
            if (connID != "")
            {
                conn.ID = connID;
            }
        }
Beispiel #3
0
        public static void ChangeColorOfVariableNode(ObjectPort op, string type = "Generic")
        {
            if (op.ParentNode.Types == NodeTypes.VariableSet)
            {
                op.ParentNode.Background = ImperativeColor(type);
            }
            if (op.Linked)
            {
                switch (type)
                {
                case "Generic":
                    op.StrokeBrush = ImperativeColor(type);
                    op.Background  = ImperativeColor(type);
                    break;

                case "Character":
                    op.StrokeBrush = ImperativeColor(type);
                    op.Background  = ImperativeColor(type);

                    break;

                case "Logical":
                    op.StrokeBrush = ImperativeColor(type);
                    op.Background  = ImperativeColor(type);

                    break;

                case "Numeric":
                    op.StrokeBrush = ImperativeColor(type);
                    op.Background  = ImperativeColor(type);

                    break;

                case "DataFrame":
                    op.StrokeBrush = ImperativeColor(type);
                    op.Background  = ImperativeColor(type);

                    break;

                default:

                    op.Background  = ImperativeColor(type);
                    op.StrokeBrush = ImperativeColor(type);
                    break;
                }
            }
            else
            {
                switch (type)
                {
                case "Generic":
                    op.StrokeBrush = ImperativeColor(type);

                    break;

                case "Character":
                    op.StrokeBrush = ImperativeColor(type);

                    break;

                case "Logical":
                    op.StrokeBrush = ImperativeColor(type);

                    break;

                case "Numeric":
                    op.StrokeBrush = ImperativeColor(type);

                    break;

                case "DataFrame":
                    op.StrokeBrush = ImperativeColor(type);

                    break;

                default:

                    op.StrokeBrush = ImperativeColor(type);
                    break;
                }
            }
        }