示例#1
0
        public SettingsForm(ISqlSettings settings, Assembly pluginAssembly, string aboutDescription, GetTextEditorKeyBindingScopeName keyBindingScopeNameMethod)
        {
            _settings         = settings;
            _pluginAssembly   = pluginAssembly;
            _aboutDescription = aboutDescription;

            _keyBindingScopeNameMethod = keyBindingScopeNameMethod;

            foreach (System.Configuration.SettingsProperty prop in _settings.Properties)
            {
                if (prop.Name.Equals("Hotkey"))
                {
                    _supportsHotkey = true;
                }
            }

            InitializeComponent();

            if (!_supportsHotkey)
            {
                txt_Hotkey.Visible     = false;
                lbl_Hotkey.Visible     = false;
                lbl_HotkeyHint.Visible = false;
            }
        }
        public SettingsForm(ISqlSettings settings, Assembly pluginAssembly, string aboutDescription, GetTextEditorKeyBindingScopeName keyBindingScopeNameMethod)
        {
            _settings = settings;
            _pluginAssembly = pluginAssembly;
            _aboutDescription = aboutDescription;

            _keyBindingScopeNameMethod = keyBindingScopeNameMethod;

            foreach (System.Configuration.SettingsProperty prop in _settings.Properties)
                if (prop.Name.Equals("Hotkey"))
                    _supportsHotkey = true;

            InitializeComponent();

            if (!_supportsHotkey)
            {
                txt_Hotkey.Visible = false;
                lbl_Hotkey.Visible = false;
                lbl_HotkeyHint.Visible = false;
            }
        }
        public GenericVSHelper(bool isVisualStudio, GetTextEditorKeyBindingScopeName keyBindingScopeNameDelegate, GetKeyBinding getKeyBindingDelegate, SetKeyBinding setKeyBindingDelegate)
        {
            _isVisualStudio = isVisualStudio;
            _getKeyBindingScopeNameDelegate = keyBindingScopeNameDelegate;
            _getKeyBindingDelegate          = getKeyBindingDelegate;
            _setKeyBindingDelegate          = setKeyBindingDelegate;

            //upgrade settings if necessary.
            if (!Properties.Settings.Default.UpgradeCompleted)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeCompleted = true;
                Properties.Settings.Default.Save();
            }

            if (!Properties.Settings.Default.FirstInstallCompleted)
            {
                if (_isVisualStudio || _getKeyBindingScopeNameDelegate == null)
                {
                    //no default shortcut in VS, nor do we store it in settings if VSPackage context / managed through VS Shell only
                    Properties.Settings.Default.Hotkey = "";
                }
                else
                {
                    Properties.Settings.Default.Hotkey = FixHotkeyDefault(Properties.Settings.Default.Hotkey);
                }

                Properties.Settings.Default.FirstInstallCompleted = true;
                Properties.Settings.Default.Save();
            }

            //set up formatter (note - after changes to Settings through the UI this line will appear to error,
            // with settings not implementing the necessary interface, but a prebuild search & replace step will
            // automatically fix the settings file)
            _formattingManager = PluginShared.Utils.GetFormattingManager(Properties.Settings.Default);
        }