private void InitConfig() { try { // load app's json config file configHelper.LoadConfig(); // Note: data is read from json\PGDemoConfig.json appValues = ConfigHelper.Instance.appConfig.appValues; // check for hard-coded ApiKey if (string.IsNullOrEmpty(ApiKey)) { ApiKey = appValues.ApiKey; } // check for ApiKey in config file if (!string.IsNullOrEmpty(ApiKey)) { PGApi.SetApiKey(ApiKey); } // VerboseInfo will provide more text info VerboseInfo = appValues.VerboseInfo; CloseWindowOnEscape = appValues.CloseWindowOnEscape; } catch (System.Exception ex) { string ErrorMessage = $"InitConfig() error: {ex.Message}"; Debug.WriteLine(ErrorMessage); } }
private void OnApiKeyEntered(string ApiKey) { if (!string.IsNullOrEmpty(ApiKey)) { ApiKeyText.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("LightGreen")); PGApi.SetApiKey(ApiKey); IsPaused = false; StartApp(); } }
private void OnApiKeyPaste(object sender, DataObjectPastingEventArgs e) { var IsText = e.SourceDataObject.GetDataPresent(DataFormats.UnicodeText, true); if (!IsText) { return; } string ApiKey = e.SourceDataObject.GetData(DataFormats.UnicodeText) as string; PGApi.SetApiKey(ApiKey); e.Handled = true; }