コード例 #1
0
        public static void CreateExecutionConnector(VirtualControl host, string xid, int xindex, string yid, int yindex,
                                                    string connId = "")
        {
            ExecPort x = null, y = null;

            foreach (var node in host.Nodes)
            {
                if (node.Id == xid)
                {
                    x = node.OutExecPorts[xindex];
                }
                else if (node.Id == yid)
                {
                    y = node.InExecPorts[yindex];
                }
            }
            if (y == null || x == null)
            {
                return;
            }
            x.ConnectedConnectors.ClearConnectors();

            y.ConnectedConnectors.ClearConnectors();
            x.Linked = false;
            y.Linked = false;
            Connector conn;

            conn = x.PortTypes == PortTypes.Output
                ? new ExecutionConnector(host, x, y)
                : new ExecutionConnector(host, y, x);
            Panel.SetZIndex(conn.Wire, ZIndexes.ConnectorIndex);

            conn.EndPort.ConnectedConnectors.Add(conn);
            conn.StartPort.ConnectedConnectors.Add(conn);
            host.Children.Remove(host.TempConn);
            host.Children.Remove(host.TempConn);
            host.TemExecPort = null;
            host.WireMode    = WireMode.Nothing;
            host.MouseMode   = MouseMode.Nothing;
            host.HideLinkingPossiblity();
            host.ExecutionConnectors.Add((ExecutionConnector)conn);
            if (connId != "")
            {
                conn.ID = connId;
            }
        }
コード例 #2
0
        public static void CreateExecutionConnector(VirtualControl host, ExecPort x, ExecPort y, string connId = "")
        {
            string id;

            if (connId == "")
            {
                id = Guid.NewGuid().ToString();
            }
            else
            {
                id = connId;
            }

            x.ConnectedConnectors.ClearConnectors();

            y.ConnectedConnectors.ClearConnectors();
            x.Linked = false;
            y.Linked = false;
            Connector conn;

            conn = x.PortTypes == PortTypes.Output
                ? new ExecutionConnector(host, x, y)
                : new ExecutionConnector(host, y, x);
            Panel.SetZIndex(conn.Wire, ZIndexes.ConnectorIndex);
            conn.EndPort.ConnectedConnectors.Add(conn);
            conn.StartPort.ConnectedConnectors.Add(conn);
            host.Children.Remove(host.TempConn);
            host.Children.Remove(host.TempConn);
            host.TemExecPort = null;
            host.WireMode    = WireMode.Nothing;
            host.MouseMode   = MouseMode.Nothing;
            host.HideLinkingPossiblity();
            host.ExecutionConnectors.Add((ExecutionConnector)conn);
            if (connId != "")
            {
                conn.ID = connId;
            }
        }