Beispiel #1
0
        public string Render()
        {
            string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";

            string result = null;

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

                string guid = Properties["Guid"];
                result = OoXmlFile.CreateFromCml(Cml, guid, _rendererOptions, Telemetry, TopLeft);
                if (!File.Exists(result))
                {
                    Telemetry.Write(module, "Exception", "Structure could not be rendered.");
                    UserInteractions.WarnUser("Sorry this structure could not be rendered.");
                }

                // Deliberate crash to test Error Reporting
                //int ii = 2;
                //int dd = 0;
                //int bang = ii / dd;
            }
            catch (Exception ex)
            {
                new ReportError(Telemetry, TopLeft, module, ex).ShowDialog();
            }

            return(result);
        }
Beispiel #2
0
        public bool ChangeSettings(Point topLeft)
        {
            string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";

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

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

                OoXmlV4Options tempOptions = _rendererOptions.Clone();
                settings.SettingsPath    = SettingsPath;
                settings.RendererOptions = tempOptions;

                DialogResult dr = settings.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    _rendererOptions = tempOptions.Clone();
                }
                settings.Close();
            }
            catch (Exception ex)
            {
                new ReportError(Telemetry, TopLeft, module, ex).ShowDialog();
            }

            return(true);
        }
        public OoXmlV4Options Clone()
        {
            OoXmlV4Options clone = new OoXmlV4Options();

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

            clone.SettingsPath = SettingsPath;

            return(clone);
        }
Beispiel #4
0
        private void SetValuesFromCopy(OoXmlV4Options options)
        {
            // Main User Options
            ColouredAtoms        = options.ColouredAtoms;
            ShowHydrogens        = options.ShowHydrogens;
            ShowMoleculeGrouping = options.ShowMoleculeGrouping;
            ShowMoleculeLabels   = options.ShowMoleculeLabels;
            ShowCarbons          = options.ShowCarbons;

            // Hidden
            BondLength = options.BondLength;

            // Debugging Options
            ClipLines = options.ClipLines;
            ShowCharacterBoundingBoxes = options.ShowCharacterBoundingBoxes;
            ShowMoleculeBoundingBoxes  = options.ShowMoleculeBoundingBoxes;
            ShowRingCentres            = options.ShowRingCentres;
            ShowAtomPositions          = options.ShowAtomPositions;
            ShowHulls             = options.ShowHulls;
            ShowBondClippingLines = options.ShowBondClippingLines;
            ShowBondDirection     = options.ShowBondDirection;
        }