예제 #1
0
파일: Commor.cs 프로젝트: jtzhang163/Arthur
        public Result EndConnect()
        {
            var result = new Result();

            if (this.Communicator.CommType == "Serial")
            {
                result = new SerialComm().EndConnect(this);
            }
            else if (this.Communicator.CommType == "OmronFinsTcp")
            {
                result = new OmronFinsTcpComm().EndConnect(this);
            }
            else if (this.Communicator.CommType == "Ethernet")
            {
                result = new EthernetComm().EndConnect(this);
            }
            Connected = false;
            return(Result.Success);
        }
예제 #2
0
파일: Commor.cs 프로젝트: jtzhang163/Arthur
        public Result Connect()
        {
            var result = new Result();

            if (!this.Connected)
            {
                if (this.Communicator.CommType == "Serial")
                {
                    result = new SerialComm().Connect(this);
                }
                else if (this.Communicator.CommType == "OmronFinsTcp")
                {
                    result = new OmronFinsTcpComm().Connect(this);
                }
                else if (this.Communicator.CommType == "Ethernet")
                {
                    result = new EthernetComm().Connect(this);
                }
            }

            this.Connected = result.IsSucceed;
            return(result);
        }