private void AddResult(MetaDataPluginDescriptor plugin, object value, string defaultPlugin) { LabelControl lblPlugin = new LabelControl(); lblPlugin.Text = plugin.DataProviderName; if (defaultPlugin == plugin.DataProviderName) { lblPlugin.Font = new Font(lblPlugin.Font, FontStyle.Bold); } // Add context menu of other search results ContextMenu menu = new ContextMenu(); menu.Tag = plugin; Title[] matches = OMLSDK.SDKUtilities.ConvertOMLSDKTitlesToTitles(plugin.PluginDLL.GetAvailableTitles()); for (int i = 0; i < matches.Length; i++) { MenuItem item = new MenuItem(matches[i].Name, new EventHandler(otherTitle_Click)); item.Tag = i; menu.MenuItems.Add(item); } lblPlugin.ContextMenu = menu; Control ctrl = CreateValueControl(plugin.DataProviderName, value); if (ctrl != null) { tblData.Controls.Add(lblPlugin); tblData.Controls.Add(ctrl); } Application.DoEvents(); }
public DialogResult Show(List <MetaDataPluginDescriptor> plugins) { _selectdPlugin = null; if (plugins != null) { foreach (MetaDataPluginDescriptor plugin in plugins) { lbMetadataPlugins.Items.Add(plugin); } lbMetadataPlugins.DisplayMember = "DataProviderName"; } return(ShowDialog()); }
public frmSearchResult(MetaDataPluginDescriptor plugin, string searchstr, string EpisodeName, int?SeasonNo, int?EpisodeNo, bool ShowTVFields, bool pSearchTVShowOnly) //MainEditor opener) { _plugin = plugin; SearchTVShowOnly = pSearchTVShowOnly; InitializeComponent(); chkUpdateMissingDataOnly.Checked = !OMLEngine.Settings.OMLSettings.MetadataLookupOverwriteExistingDataManual; chkUpdateTitleName.Checked = OMLEngine.Settings.OMLSettings.MetadataLookupUpdateNameManual; if (string.IsNullOrEmpty(_plugin.DataProviderLink)) { lcProviderMessage.Text = plugin.DataProviderMessage; } else { lcProviderMessage.Text = plugin.DataProviderMessage + " - Click to view website"; } // Hide the tv fields of not reqiured if (!ShowTVFields) { teEpisodeName.Visible = false; seEpisodeNo.Visible = false; seSeasonNo.Visible = false; lcEpisodeLabel.Visible = false; lcSeasonNoLabel.Visible = false; lcEpisodeNoLabel.Visible = false; reSearchSubmitButton.Location = new Point(335, 3); } reSearchTitle.Text = searchstr; LastSearchTitle = searchstr; teEpisodeName.Text = EpisodeName; LastEpisodeName = EpisodeName; if (SeasonNo != null) { seSeasonNo.Value = Convert.ToInt32(SeasonNo); LastSeasonNo = Convert.ToInt32(SeasonNo); } if (EpisodeNo != null) { seEpisodeNo.Value = Convert.ToInt32(EpisodeNo); LastEpisodeNo = Convert.ToInt32(EpisodeNo); } Search(); }
void otherTitle_Click(object sender, EventArgs e) { MenuItem item = sender as MenuItem; ContextMenu menu = item.Parent as ContextMenu; MetaDataPluginDescriptor plugin = ((MetaDataPluginDescriptor)menu.Tag); Title selectedTitle = OMLSDK.SDKUtilities.ConvertOMLSDKTitleToTitle(plugin.PluginDLL.GetTitle((int)item.Tag)); for (int i = 0; i < tblData.Controls.Count; i++) { Control ctrl = tblData.Controls[i]; if (ctrl is LabelControl && ctrl.Text == plugin.DataProviderName) { int row = i / 2; tblData.Controls.RemoveAt(i + 1); tblData.Controls.Add(CreateValueControl(plugin.DataProviderName, _propertyInfo.GetValue(selectedTitle, null)), 1, row); return; } } }
public bool SelectedPlugin(out MetaDataPluginDescriptor selectedplugin) { selectedplugin = null; if (cmbPlugins.SelectedItem == "From Preferred Sources") { // Preferred metadata selected. Leave selectedplugin as null return(true); } var qry = from t in _metadataPlugins where t.DataProviderName == (cmbPlugins.SelectedItem as string) select t; if (qry.Count() > 0) { // A Plugin has been selected selectedplugin = qry.First(); return(true); } // Nothing selected return(false); }
private void lbMetadataPlugins_SelectedIndexChanged(object sender, EventArgs e) { if (lbMetadataPlugins.SelectedItem != null) { grdOptions.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(grdOptions_EditingControlShowing); grdOptions.Rows.Clear(); MetaDataPluginDescriptor plugin = lbMetadataPlugins.SelectedItem as MetaDataPluginDescriptor; _selectdPlugin = plugin; List <OMLMetadataOption> options = plugin.PluginDLL.GetOptions(); if (options != null) { foreach (OMLMetadataOption option in options) { DataGridViewRow row = new DataGridViewRow(); // Code to get edited combo box based on- // http://www.sommergyll.com/datagridview-usercontrols/datagridview-with-combobox.htm // Create the combo box DataGridViewComboBoxCell cbcell = new DataGridViewComboBoxCell(); //if (!option.AllowOnlyPossibleValues) //else // grdOptions.EditingControlShowing -= new DataGridViewEditingControlShowingEventHandler(grdOptions_EditingControlShowing); // Add possible values to the combo if (option.PossibleValues != null) { if (option.PossibleValues.Count > 0) { foreach (KeyValuePair <string, string> v in option.PossibleValues) { cbcell.Items.Add(v.Value); } } } // Select currently selected value if (!string.IsNullOrEmpty(option.Value)) { string currentselectedoption = option.Value; if (option.PossibleValues != null) { if (option.PossibleValues.ContainsKey(option.Value)) { currentselectedoption = option.PossibleValues[option.Value]; } } if (!cbcell.Items.Contains(currentselectedoption)) { cbcell.Items.Add(option.Value); } cbcell.Value = currentselectedoption; } // Create the trext box option name DataGridViewTextBoxCell b; b = new DataGridViewTextBoxCell(); b.Value = option.Name; // Create the row row.Cells.Add(b); b.ReadOnly = true; row.Cells.Add(cbcell); row.Tag = option; grdOptions.Rows.Add(row); } } } }