Example #1
0
        private void btn_Reset_Click(object sender, EventArgs e)
        {
            Dictionary <string, object> previousValues = new Dictionary <string, object>();

            foreach (System.Configuration.SettingsProperty prop in _settings.Properties)
            {
                previousValues.Add(prop.Name, _settings[prop.Name]);
            }

            _settings.Reset();

            //unfortuntely, the Hotkey "True" default is not very useful in VS environments, need to
            // grab the localized value from the VS context.
            if (_supportsHotkey && _keyBindingScopeNameMethod != null)
            {
                string scopeName = _keyBindingScopeNameMethod();
                if (scopeName != null)
                {
                    _settings["Hotkey"] = _settings["Hotkey"].ToString().Replace("Text Editor", scopeName);
                }
            }

            LoadControlValuesFromSettings();

            foreach (string prop in previousValues.Keys)
            {
                _settings[prop] = previousValues[prop];
            }
            _settings.Save(); //because reset, irritatingly, saves.
        }