private static KeyCombo RetrieveKeyComboValue(SettingsRegKey key, string valueName, ref string member) { string text = SettingsRegKey.RetrieveStringValue(key, valueName, ref member); KeyCombo returnKey = null; // set default KeyCombo if (string.IsNullOrWhiteSpace(text)) { if (valueName == _screenCaptureShortcutName) { returnKey = KeyCombo.ParseOrDefault("Snapshot"); ScreenCaptureShortcut = returnKey; } else if (valueName == _quickCaptureShortcutName) { returnKey = KeyCombo.ParseOrDefault("None"); QuickCaptureShortcut = returnKey; } else if (valueName == _libraryShortcutName) { returnKey = KeyCombo.ParseOrDefault("None"); LibraryShortcut = returnKey; } } else { returnKey = KeyCombo.ParseOrDefault(text); } return(returnKey); }
/// <summary> /// Fetch API keys/endpoints for cognitive services /// </summary> /// <param name="keyName">Name of the service, whose value is fetched</param> /// <param name="defaultValue">if the key does not exist, use this default</param> /// <returns></returns> internal static string GetKey(string keyName, string defaultValue) { var value = SettingsRegKey.RetrieveStringValue(SettingsKey, keyName, ref _key); if (string.IsNullOrEmpty(value)) { value = defaultValue; SetKey(keyName, value); } return(value); }
/// <summary> /// Fetch API keys/endpoints for cognitive services /// </summary> /// <param name="keyName">Name of the service, whose value is fetched</param> /// <param name="defaultValue">if the key does not exist, use this default</param> /// <returns></returns> internal static string GetKey(string keyName, string defaultValue, bool createIfNew = false) { var value = SettingsRegKey.RetrieveStringValue(SettingsKey, keyName, ref _key); if (string.IsNullOrWhiteSpace(value)) { value = defaultValue; if (createIfNew) { SetKey(keyName, value); } } return(value); }
/// <summary> /// Fetch API keys for cognitive services. /// </summary> /// <param name="keyName">Name of the service, whose key is fetched</param> /// <returns>Key</returns> internal static string GetKey(string keyName) { return(SettingsRegKey.RetrieveStringValue(SettingsKey, keyName, ref _key)); }