Exemple #1
0
        public DialogResult Search()
        {
            string       module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";
            DialogResult result = DialogResult.Abort;

            try
            {
                _searcherOptions = new SearcherOptions(SettingsPath);

                SearchOpsin searcher = new SearchOpsin();
                searcher.TopLeft      = TopLeft;
                searcher.Telemetry    = Telemetry;
                searcher.SettingsPath = SettingsPath;
                searcher.UserOptions  = _searcherOptions;

                result = searcher.ShowDialog();
                if (result == DialogResult.OK)
                {
                    Properties = new Dictionary <string, string>();
                    Cml        = searcher.Cml;
                }
            }
            catch (Exception ex)
            {
                new ReportError(Telemetry, TopLeft, module, ex).ShowDialog();
            }
            return(result);
        }
Exemple #2
0
        public bool ChangeSettings(Point topLeft)
        {
            string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";

            try
            {
                Telemetry.Write(module, "Verbose", "Called");
                _searcherOptions = new SearcherOptions(SettingsPath);

                Settings settings = new Settings();
                settings.Telemetry = Telemetry;
                settings.TopLeft   = topLeft;

                SearcherOptions 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);
        }
        public SearcherOptions Clone()
        {
            SearcherOptions clone = new SearcherOptions();

            // Copy serialised properties
            clone.SetValuesFromCopy(this);

            clone.SettingsPath = SettingsPath;

            return(clone);
        }
 private void SetValuesFromCopy(SearcherOptions options)
 {
     OpsinWebServiceUri = options.OpsinWebServiceUri;
     DisplayOrder       = options.DisplayOrder;
 }