public void EventAllConfigsLB_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e) { System.Windows.Forms.ListBox _ListBox = (System.Windows.Forms.ListBox)sender; int index = _ListBox.IndexFromPoint(e.Location); string item = (string)_ListBox.Items[index]; string configSetting = item.Substring(0, item.IndexOf('=')); string configValue = item.Substring(item.IndexOf('=') + 1); string changedValue; Func <string, bool> validator = null; StaticValues.SettingsValidateFunctions.TryGetValue(configSetting, out validator); if (ChangeValueBox.ChangeValue("Change Value for Setting(" + configSetting + ")", configValue, validator, out changedValue) == true) { _SetConfigString(configSetting, changedValue); } }
public void EventAllConfigsLB_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e) { System.Windows.Forms.ListBox _ListBox = (System.Windows.Forms.ListBox)sender; int index = _ListBox.IndexFromPoint(e.Location); string item = (string)_ListBox.Items[index]; string configSetting = item.Substring(0, item.IndexOf('=')); string configValue = item.Substring(item.IndexOf('=') + 1); string changedValue; Func <string, bool> validator = (string _Value) => { if (_Value == "enabled" || _Value == "disabled") { return(true); } return(false); }; if (ChangeValueBox.ChangeValue("activate addon \"" + configSetting + "\" set to value(enabled / disabled)", configValue, validator, out changedValue) == true) { _SetConfigString(configSetting, changedValue); } }