public bool ChangeSettings(Point topLeft) { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; try { Telemetry.Write(module, "Verbose", "Called"); _searcherOptions = new ExampleOptions(SettingsPath); ExampleSettings settings = new ExampleSettings(); settings.Telemetry = Telemetry; settings.TopLeft = topLeft; var 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 ExampleOptions Clone() { ExampleOptions clone = new ExampleOptions(); // Copy serialised properties clone.SetValuesFromCopy(this); clone.SettingsPath = SettingsPath; return(clone); }
public DialogResult Search() { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; DialogResult dr = DialogResult.Cancel; try { // ToDo: Set any (extra) Properties required before calling this function // ToDo: Set Cml property with search result // ToDo: Return DialogResult.OK if operation not cancelled _searcherOptions = new ExampleOptions(SettingsPath); } catch (Exception ex) { new ReportError(Telemetry, TopLeft, module, ex).ShowDialog(); } return(dr); }
private void SetValuesFromCopy(ExampleOptions options) { Property1 = options.Property1; Property2 = options.Property2; }