private async void Initialize() { ToggleWindow(false); try { _log.Info("Initializing..."); ConfigFile = await IniFile.LoadAsync(App.ExecutableName + ".ini"); MainConfig = ConfigFile[App.ExecutableName]; CurrentVersion = MainConfig["CurrentVersion"]; _log.Info("Config loaded."); IniSection githubSection = ConfigFile["Github"]; _githubHelper = new GithubHelper( githubSection["UserName"], githubSection["RepoName"], githubSection["BaseUri"], githubSection["BaseApiUri"] ); _log.Info("Github helper initialized."); _httpClient = new AdvancedHttpClient(); _httpClient.DefaultRequestHeaders.Accept.Clear(); _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // Required to use GitHub API. _httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(App.ExecutableName, App.CurrentVersion)); _log.Info("HTTP client initalized."); SetCurrentStage(OperationStage.Check); } catch (Exception e) { string errorMessage = string.Format("Failed to initialize: {0}", e.Message); _log.Error(errorMessage); App.ExitWithMessage(errorMessage, MessageBoxImage.Error); } ToggleWindow(true); }