private void btnOk_Click(object sender, EventArgs e) { if (_selectdPlugin != null) { foreach (DataGridViewRow row in grdOptions.Rows) { string optionname = (string)row.Cells[colOptionName.Index].Value; string valuestr = (string)row.Cells[colOptionValue.Index].Value; OMLMetadataOption option = row.Tag as OMLMetadataOption; // Reverse lookup the description to find the option name if (option.PossibleValues != null) { if (option.PossibleValues.ContainsValue(valuestr)) { var key = (from k in option.PossibleValues where string.Compare(k.Value, valuestr) == 0 select k.Key).FirstOrDefault(); valuestr = key; } } // Set the value in the plugin _selectdPlugin.PluginDLL.SetOptionValue(optionname, valuestr); // Set the value in the db OMLEngine.Settings.SettingsManager.SaveSettingByName(optionname, valuestr, "PLG-" + _selectdPlugin.DataProviderName); } } }
private void grdOptions_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { foreach (DataGridViewRow row in grdOptions.SelectedRows) { OMLMetadataOption option = row.Tag as OMLMetadataOption; if (!option.AllowOnlyPossibleValues) { DataGridViewComboBoxEditingControl comboControl = e.Control as DataGridViewComboBoxEditingControl; if (comboControl != null) { comboControl.DropDownStyle = ComboBoxStyle.DropDown; } } } /* DataGridViewComboBoxEditingControl comboControl * = e.Control as DataGridViewComboBoxEditingControl; * if (comboControl != null) * { * // Set the DropDown style to get an editable ComboBox * if (comboControl.DropDownStyle != ComboBoxStyle.DropDown) * { * comboControl.DropDownStyle = ComboBoxStyle.DropDown; * } * }*/ }
public List <OMLMetadataOption> GetOptions() { List <OMLMetadataOption> options = new List <OMLMetadataOption>(); OMLMetadataOption apikey = null; OMLMetadataOption sharedsecret = null; if (API_KEY == DEFAULT_API_KEY) { apikey = new OMLMetadataOption("API Key", API_KEY_HIDDEN_TEXT, null, false); } else { apikey = new OMLMetadataOption("API Key", API_KEY, null, false); } if (SHARED_SECRET == DEFAULT_SHARED_SECRET) { sharedsecret = new OMLMetadataOption("Shared Secret", SHARED_SECRET_HIDDEN_TEXT, null, false); } else { sharedsecret = new OMLMetadataOption("Shared Secret", SHARED_SECRET, null, false); } options.Add(apikey); options.Add(sharedsecret); return(options); }
public List <OMLMetadataOption> GetOptions() { List <OMLMetadataOption> options = new List <OMLMetadataOption>(); // API Key option OMLMetadataOption apikey = null; if (API_KEY == DEFAULT_API_KEY) { apikey = new OMLMetadataOption("API Key", API_KEY_HIDDEN_TEXT, null, false); } else { apikey = new OMLMetadataOption("API Key", API_KEY, null, false); } options.Add(apikey); // Fan Art enabled option Dictionary <string, string> YesNo = new Dictionary <string, string>(); YesNo["Yes"] = "Yes"; YesNo["No"] = "No"; OMLMetadataOption fanart = null; if (FanartEnabled) { fanart = new OMLMetadataOption("Fanart Enabled", "Yes", YesNo, true); } else { fanart = new OMLMetadataOption("Fanart Enabled", "No", YesNo, true); } options.Add(fanart); return(options); }