private void OnSearchersSelectedIndexChanged(object sender, EventArgs e) { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; try { PlugInComboItem pci = cboSearchers.SelectedItem as PlugInComboItem; lblSearcherDescription.Text = pci.Description; IChem4WordSearcher searcher = Globals.Chem4WordV3.GetSearcherPlugIn(pci.Name); btnSearcherSettings.Enabled = searcher.HasSettings; } catch (Exception ex) { new ReportError(Globals.Chem4WordV3.Telemetry, TopLeft, module, ex).ShowDialog(); } }
private void OnEditorsSelectedIndexChanged(object sender, EventArgs e) { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; try { PlugInComboItem pci = cboEditors.SelectedItem as PlugInComboItem; SystemOptions.SelectedEditorPlugIn = pci.Name; lblEditorDescription.Text = pci.Description; IChem4WordEditor editor = Globals.Chem4WordV3.GetEditorPlugIn(pci.Name); btnEditorSettings.Enabled = editor.HasSettings; _dirty = true; } catch (Exception ex) { new ReportError(Globals.Chem4WordV3.Telemetry, TopLeft, module, ex).ShowDialog(); } }
private void LoadSettings() { cboEditors.Items.Clear(); cboRenderers.Items.Clear(); cboSearchers.Items.Clear(); btnEditorSettings.Enabled = false; btnRendererSettings.Enabled = false; btnSearcherSettings.Enabled = false; string selectedEditor = SystemOptions.SelectedEditorPlugIn; foreach (IChem4WordEditor editor in Globals.Chem4WordV3.Editors) { PlugInComboItem pci = new PlugInComboItem() { Name = editor.Name, Description = editor.Description }; int item = cboEditors.Items.Add(pci); if (editor.Name.Equals(selectedEditor)) { btnEditorSettings.Enabled = editor.HasSettings; cboEditors.SelectedIndex = item; } } string selectedRenderer = SystemOptions.SelectedRendererPlugIn; foreach (IChem4WordRenderer renderer in Globals.Chem4WordV3.Renderers) { PlugInComboItem pci = new PlugInComboItem() { Name = renderer.Name, Description = renderer.Description }; int item = cboRenderers.Items.Add(pci); if (renderer.Name.Equals(selectedRenderer)) { btnRendererSettings.Enabled = renderer.HasSettings; cboRenderers.SelectedIndex = item; } } foreach (IChem4WordSearcher searcher in Globals.Chem4WordV3.Searchers.OrderBy(s => s.DisplayOrder)) { PlugInComboItem pci = new PlugInComboItem() { Name = searcher.Name, Description = searcher.Description }; int item = cboSearchers.Items.Add(pci); if (cboSearchers.Items.Count == 1) { btnSearcherSettings.Enabled = searcher.HasSettings; cboSearchers.SelectedIndex = item; } } chkUseWebServices.Checked = SystemOptions.UseWebServices; txtChemSpiderRdfUri.Text = SystemOptions.ChemSpiderRdfServiceUri; txtChemSpiderWsUri.Text = SystemOptions.ChemSpiderWebServiceUri; chkTelemetryEnabled.Checked = SystemOptions.TelemetryEnabled; cboUpdateFrequency.Items.Clear(); cboUpdateFrequency.Items.Add("Daily"); cboUpdateFrequency.Items.Add("Weekly"); switch (SystemOptions.AutoUpdateFrequency) { case 1: cboUpdateFrequency.SelectedIndex = 0; break; case 7: cboUpdateFrequency.SelectedIndex = 1; break; default: cboUpdateFrequency.SelectedIndex = 0; break; } }