public void Close() { DSC19ClientStatus status = (DSC19ClientStatus)GW21API.AB_GW_Status(NodeID); if (status == DSC19ClientStatus.Connecting) { int iReturn; iReturn = GW21API.AB_GW_Close(NodeID); if (iReturn > 0) { ClientStatus = DSC19ClientStatus.Closed; } } }
public void Open() { try { DSC19ClientStatus status = (DSC19ClientStatus)GW21API.AB_GW_Status(NodeID); if (status != DSC19ClientStatus.Connecting) { ClientStatus = (DSC19ClientStatus)GW21API.AB_GW_Open(NodeID); System.Threading.Thread.Sleep(200); status = (DSC19ClientStatus)GW21API.AB_GW_Status(NodeID); } ClientStatus = status; } catch (Exception ex) { if (OnError != null) { OnError(this, new CommandEventArgs(ex.Message)); } } }