Esempio n. 1
0
        /// <summary>
        ///     Gets an existing http client.
        /// </summary>
        /// <param name="username">Account username.</param>
        /// <returns>Http client.</returns>
        public HttpClient GetClient(string username, string host)
        {
            var client = AllClients
                         .Except(Clients.Select(i => i.Value))
                         .FirstOrDefault();

            if (client == null)
            {
                client = CreateClient(host);
                AllClients.Add(client);
                Clients.Add(username, client);
            }

            return(client);
        }