Esempio n. 1
0
        /// <summary>
        /// 获取指定管脚路径的外部管脚变量。
        /// </summary>
        public IConnector GetExternalConnector(string connPath)
        {
            if (string.IsNullOrEmpty(connPath))
            {
                return(null);
            }

            string cpuName   = ViConnType.RetrieveCpuName(connPath);
            string planName  = ViConnType.RetrievePlanName(connPath);
            string blockName = ViConnType.RetrieveBlockName(connPath);
            string connName  = ViConnType.RetrieveConnectorName(connPath);

            if (string.IsNullOrEmpty(cpuName) || string.IsNullOrEmpty(planName))
            {
                return(null);
            }
            if (!this.CPU.Key.Equals(cpuName, StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }
            ICfcEditorInfo editor = this.GetCfcEditor(planName, true) as ICfcEditorInfo;

            if (editor == null)
            {
                return(null);
            }

            return(editor.GetConnector(connPath));
        }
Esempio n. 2
0
        /// <summary>
        /// 取消另一个文件中的连接信息。
        /// </summary>
        /// <param name="uuid">夸CFC连线变量ID</param>
        /// <param name="planName">发起请求的文件名称</param>
        public void DisConnectTo(string uuid, string requestFileName)
        {
            if (string.IsNullOrEmpty(requestFileName))
            {
                return;
            }
            ExternalConnection extConn = this.ExtConnList.GetGlobalVariable(uuid) as ExternalConnection;

            if (extConn == null)
            {
                return;
            }

            string targetConnPath = string.Empty;
            string targetFile     = string.Empty;

            if (string.Compare(requestFileName, extConn.GetSourceProgramName(), true) == 0)
            {
                targetConnPath = extConn.TargetPath;
                targetFile     = extConn.GetTargetProgramName();
            }
            else
            {
                targetConnPath = extConn.SourcePath;
                targetFile     = extConn.GetSourceProgramName();
            }

            ICfcEditorInfo targetEditor = this.GetCfcEditor(targetFile, true) as ICfcEditorInfo;

            if (targetEditor != null)
            {
                this.ExtConnList.RemoveGlobalVariable(uuid);
                IConnector targetConn = targetEditor.GetConnector(targetConnPath);
                if (targetConn != null)
                {
                    targetConn.DisConnectToExtConnector(extConn);
                }
            }
            else
            {
                extConn.ValidState = false;
            }
        }