public ChessServiceClientSession(string baseUrl, string username, string password) { _username = username; _password = password; BaseUrl = baseUrl; _client = new ChessServiceClient(BaseUrl); }
/// <summary> /// Creates an instance of the service connection class. /// </summary> /// <param name="baseUrl">The base URL of the service the client connects to.</param> public ServiceConnection(string baseUrl) { _lock = new object(); _client = new ChessServiceClient(baseUrl); _runningMethods = new ConcurrentHashSet <string>(); _mechanism = new ChessMechanism(); _players = new List <Player>(); _matches = new List <ChessGameDetails>(); CurrentGame = null; InitTokenRefreshTimer(); InitStateRefreshTimer(); }
// The bulk of the clean-up code is implemented in Dispose(bool) protected virtual void Dispose(bool disposing) { if (!disposing) { return; } if (_client == null) { return; } _client.Dispose(); _client = null; }
/// <summary> /// Disposes the object in a safe way. /// Used internally! Do not use directly! /// </summary> /// <param name="disposing">Is disposing?</param> protected virtual void Dispose(bool disposing) { lock (_lock) { if (_disposed) { return; } if (!disposing) { return; } if (_client == null) { return; } _client.Dispose(); _client = null; _disposed = true; } }