Esempio n. 1
0
        public void OnSaveOptions()
        {
            _Saving = true;

            OptionsSaving?.Invoke(this, EventArgs.Empty);

            foreach (SettingsProperty sett in Settings)
            {
                try
                {
                    AppSettings[sett.Name] = sett.DefaultValue;
                }
                catch
                {
                }
            }

            if (AutomaticSaveSettings)
            {
                AppSettings.Save();
                AppSettings.Reload();

                OptionsSaved?.Invoke(this, EventArgs.Empty);
            }

            _Saving = false;
        }
Esempio n. 2
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            _origAsync   = otherOptsFromCtrls();
            _origRequest = requestFromCtrls();

            OptionsEventArgs args = new OptionsEventArgs(_origAsync, _origRequest);

            OptionsSaved?.Invoke(this, args);
        }
        /// <summary>
        /// Saves the properties to the registry asynchronously.
        /// </summary>
        public virtual async Task SaveAsync()
        {
            if (!_generalOptionProvider.Validate())
            {
                return;
            }

            var manager = await SettingsManager.GetValueAsync().ConfigureAwait(false);

            var settingsStore = manager.GetWritableSettingsStore(SettingsScope.UserSettings);

            try
            {
                GeneralOptionSave(settingsStore);
                InstructionOptionSave(settingsStore);

                OptionsSaved?.Invoke(this);
            }
            catch (Exception e)
            {
                Error.LogError(e, nameof(GeneralOptionModel));
            }
        }
Esempio n. 4
0
 protected virtual void OnOptionsSaved()
 {
     OptionsSaved?.Invoke(this, EventArgs.Empty); // ?. notation means not null
 }
    public OptionsSaved Settings;      //The currently loaded save file of the game options.

    public GameOptions()
    {
        Settings = new OptionsSaved();
    }