public static string GetSetting(string key, string currentValue) { var form = new FormCustomServer { txtValue = { Text = currentValue }, Text = $"Custom Value for Configuration Key: {key}" }; return(form.ShowDialog() == DialogResult.OK ? form.Result : null); }
/// <summary> /// Create a custom value for a service /// </summary> private void OnCreateCustom(object sender, EventArgs e) { if (!(sender is MenuItem menuItem)) { return; } if (!(menuItem.Tag is string key)) { return; } developmentSettings.SelectedSettings.TryGetValue(key, out var currentValue); var server = FormCustomServer.GetSetting(key, currentValue); if (string.IsNullOrEmpty(server)) { return; } developmentSettings.SelectedSettings[key] = server; SaveSettings(); ReloadSettings(); }