public DialogResult Search() { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; DialogResult result = DialogResult.Cancel; try { _searcherOptions = new PubChemOptions(SettingsPath); SearchPubChem searcher = new SearchPubChem(); searcher.TopLeft = TopLeft; searcher.Telemetry = Telemetry; searcher.SettingsPath = SettingsPath; searcher.UserOptions = _searcherOptions; result = searcher.ShowDialog(); if (result == DialogResult.OK) { Properties = new Dictionary <string, string>(); Telemetry.Write(module, "Information", $"Importing Id {searcher.PubChemId}"); Cml = searcher.Cml; } } catch (Exception ex) { new ReportError(Telemetry, TopLeft, module, ex).ShowDialog(); } return(result); }
public bool ChangeSettings(Point topLeft) { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; try { Telemetry.Write(module, "Verbose", "Called"); _searcherOptions = new PubChemOptions(SettingsPath); PubChemSettings settings = new PubChemSettings(); settings.Telemetry = Telemetry; settings.TopLeft = topLeft; PubChemOptions tempOptions = _searcherOptions.Clone(); settings.SettingsPath = SettingsPath; settings.SearcherOptions = tempOptions; DialogResult dr = settings.ShowDialog(); if (dr == DialogResult.OK) { _searcherOptions = tempOptions.Clone(); } settings.Close(); } catch (Exception ex) { new ReportError(Telemetry, TopLeft, module, ex).ShowDialog(); } return(true); }
private void SetValuesFromCopy(PubChemOptions options) { PubChemRestApiUri = options.PubChemRestApiUri; PubChemWebServiceUri = options.PubChemWebServiceUri; DisplayOrder = options.DisplayOrder; ResultsPerCall = options.ResultsPerCall; }
public PubChemOptions Clone() { PubChemOptions clone = new PubChemOptions(); // Copy serialised properties clone.SetValuesFromCopy(this); clone.SettingsPath = SettingsPath; return(clone); }