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); }
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); }