예제 #1
0
파일: Editor.cs 프로젝트: rrsc/Version3-1
        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);
        }
예제 #2
0
파일: Editor.cs 프로젝트: rrsc/Version3-1
        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);
        }
예제 #3
0
        private void SetValuesFromCopy(Cdw800Options options)
        {
            ColouredAtoms = options.ColouredAtoms;
            ShowHydrogens = options.ShowHydrogens;
            ShowCarbons   = options.ShowCarbons;

            BondLength = options.BondLength;
        }
예제 #4
0
        public Cdw800Options Clone()
        {
            Cdw800Options clone = new Cdw800Options();

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

            clone.SettingsPath = SettingsPath;

            return(clone);
        }