public DialogResult Edit() { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; DialogResult result = DialogResult.Cancel; try { Telemetry.Write(module, "Verbose", "Called"); _editorOptions = new Cdw800Options(SettingsPath); EditorHost host = new EditorHost(Cml); host.TopLeft = TopLeft; host.Telemetry = Telemetry; host.SettingsPath = SettingsPath; host.UserOptions = _editorOptions; result = host.ShowDialog(); if (result == DialogResult.OK) { Properties = new Dictionary <string, string>(); Cml = host.OutputValue; host.Close(); } } 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"); _editorOptions = new Cdw800Options(SettingsPath); Cdw800Settings settings = new Cdw800Settings(); settings.Telemetry = Telemetry; settings.TopLeft = topLeft; Cdw800Options tempOptions = _editorOptions.Clone(); settings.SettingsPath = SettingsPath; settings.EditorOptions = tempOptions; DialogResult dr = settings.ShowDialog(); if (dr == DialogResult.OK) { _editorOptions = tempOptions.Clone(); } settings.Close(); } catch (Exception ex) { new ReportError(Telemetry, TopLeft, module, ex).ShowDialog(); } return(true); }
private void SetValuesFromCopy(Cdw800Options options) { ColouredAtoms = options.ColouredAtoms; ShowHydrogens = options.ShowHydrogens; ShowCarbons = options.ShowCarbons; BondLength = options.BondLength; }
public Cdw800Options Clone() { Cdw800Options clone = new Cdw800Options(); // Copy serialised properties clone.SetValuesFromCopy(this); clone.SettingsPath = SettingsPath; return(clone); }