コード例 #1
0
        private void Save_OnClick(object sender, RoutedEventArgs e)
        {
            string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()";

            // Copy current model values to options before saving
            AcmeOptions.BondLength           = (int)SettingsModel.CurrentBondLength;
            AcmeOptions.ShowMoleculeGrouping = SettingsModel.ShowMoleculeGroups;
            AcmeOptions.ShowHydrogens        = SettingsModel.ShowImplicitHydrogens;
            AcmeOptions.ColouredAtoms        = SettingsModel.ShowAtomsInColour;
            AcmeOptions.ShowCarbons          = SettingsModel.ShowAllCarbonAtoms;

            AcmeOptions.Save();
            if (AcmeOptions.Errors.Any())
            {
                Telemetry.Write(module, "Exception", string.Join(Environment.NewLine, AcmeOptions.Errors));
                AcmeOptions.Errors = new List <string>();
            }
            AcmeOptions.Dirty = false;

            WpfEventArgs args = new WpfEventArgs();

            args.Button      = "SAVE";
            args.OutputValue = "";
            OnButtonClick?.Invoke(this, args);
        }