public MainWindow() { InitializeComponent(); ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => { Log.Warn($"SSL Certificate error"); // Change this to return true to to ignore certificate errors return(false); }; Log.Info("Reading credentials"); var config = new AppSettingsConfigProvider().Get(); if (!config.HasCredential) { config = new EnvironmentVariableConfigProvider().Get(); } if (!config.HasCredential) { MessageBox.Show( "Some or all of the following required API key details are empty: ApiKey, ApiUrl, ApiSecret.\n\nPlease set them to the correct values in application configuration file." , "Please specify your API key details" , MessageBoxButton.OK , MessageBoxImage.Error); Application.Current.Shutdown(); return; } Log.Info("Setting DataContext"); DataContext = new AppViewModel(config) { SelectedMethod = MethodMetadata.Null }; }
public MainWindow() { InitializeComponent(); var config = new AppSettingsConfigProvider().Get(); if (!config.HasCredential) { config = new EnvironmentVariableConfigProvider().Get(); } if (!config.HasCredential) { MessageBoxResult result = MessageBox.Show("Some or all of the following required API key details are empty: ApiKey, ApiUrl, ApiSecret.\n\nPlease set them to the correct values in application configuration file.", "Please specify your API key details", MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); return; } this.DataContext = new AppViewModel(config) { SelectedMethod = MethodMetadata.Null }; }