internal static async Task <bool> GetServerConfiguration(IExtendedApiClient apiClient, ILog logger) { try { apiClient.ChangeServerLocation(App.Settings.ConnectionDetails.HostName, App.Settings.ConnectionDetails.PortNo); logger.Info("Getting server configuration. Hostname ({0}), Port ({1})", apiClient.ServerHostName, apiClient.ServerApiPort); var config = await apiClient.GetServerConfigurationAsync(); App.Settings.ServerConfiguration = config; logger.Info("Getting System information"); var sysInfo = await apiClient.GetSystemInfoAsync(); App.Settings.SystemStatus = sysInfo; if (SimpleIoc.Default.IsRegistered <ApiWebSocket>()) { SimpleIoc.Default.Unregister <ApiWebSocket>(); } App.WebSocketClient = await ApiWebSocket.Create(new MBLogger(), new NewtonsoftJsonSerializer(), (ApiClient)apiClient, () => new WebSocketClient(), new CancellationToken()); return(true); } catch (HttpException ex) { logger.ErrorException("GetServerConfiguration()", ex); return(false); } }