public void Disable() { if (!IsEnabled) { throw new InvalidOperationException("Not enabled."); } _ucsAddress = null; _credentials = null; _ucsConnection.Disconnected -= ucsConnection_onDisconnected; IsEnabled = false; }
public void Enable(Uri ucsAddress, UcsCredentials credentials) { if (IsEnabled) { throw new InvalidOperationException("Already enabled."); } _ucsAddress = ucsAddress ?? throw new ArgumentNullException(nameof(ucsAddress)); _credentials = credentials ?? throw new ArgumentNullException(nameof(credentials)); IsEnabled = true; if (!_ucsConnection.IsConnected) { reconnectAsync().Wait(); } _ucsConnection.Disconnected += ucsConnection_onDisconnected; }