Exemplo n.º 1
0
        /// <summary>
        /// 建立CFC间的连线。
        /// </summary>
        /// <param name="connector">链接目标</param>
        /// <returns>夸CFC连接信息。</returns>
        public bool ConnectToExtConn(IConnector connector)
        {
            // source对应的为输出管脚信息
            ExternalConnection extConn = null;

            if (this.RegisteredConnector.IsOutputConn)
            {
                extConn = this.createExtConn(this.RegisteredConnector, connector);
            }
            else
            {
                extConn = this.createExtConn(connector, this.RegisteredConnector);
            }

            if (extConn != null)
            {
                this.RegisteredConnector.ConnectToExtConnector(extConn);
                connector.ConnectToExtConnector(extConn);
                extConn.ValidState = true;

                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        public bool ConnectToExtConn(ExternalConnection extConn, IConnector connector)
        {
            if (extConn == null || connector == null)
            {
                return(false);
            }
            if (this.GetExternalConnection(extConn.UUID) != null)
            {
                return(false);
            }

            IConnector targetConn = null;

            if (extConn.SourcePath.Equals(connector.Path))
            {
                targetConn = this.GetExternalConnector(extConn.TargetPath);
            }
            else
            {
                targetConn = this.GetExternalConnector(extConn.SourcePath);
            }

            if (targetConn == null)
            {
                return(false);
            }

            if (targetConn.CanConnectToExtConnector(connector))
            {
                this.ExtConnList.AddChild(extConn);
                targetConn.ConnectToExtConnector(extConn);
                return(true);
            }

            return(false);
        }