Ejemplo n.º 1
0
        /// <summary>
        /// Converts every active hotkey definition
        /// into its string form and stores to settings.
        /// </summary>
        public static void SaveActiveHotkeys()
        {
            var store = new StringCollection();

            foreach (var hotkey in _hotkeys.Values)
            {
                if (hotkey.KeyCombo.AllKeys.Count != 0)
                {
                    store.Add(KeyComboUtils.ConvertToSettingValue(hotkey.KeyCombo));
                }
            }
            SettingsService.Set("Hotkeys", store);
        }
Ejemplo n.º 2
0
        public void LoadKeyCombosFromSettings()
        {
            var savedHotkeys = SettingsService
                               .Get <StringCollection>("Hotkeys");

            if (savedHotkeys != null)
            {
                foreach (var hotkey in savedHotkeys)
                {
                    var keyCombo = KeyCombo.Empty;
                    try
                    {
                        keyCombo = KeyComboUtils.ConvertFromSettingValue(hotkey);
                    }
                    finally
                    {
                        _keyCombos.Add(keyCombo);
                    }
                }
            }
        }