/// <summary>
 /// Private constructor. Initializes the HotkeyRegistrar with the supplied preset to hotkey map
 /// instance. Performs initial registration of hotkeys.
 /// </summary>
 /// <param name="presetToHotkeyMap"></param>
 private HotkeyRegistrar(PresetToHotkeyMap presetToHotkeyMap)
 {
     // Register all existing hotkeys
     mPresetToHotkeyMap = presetToHotkeyMap;
     mPresetToHotkeyId  = new Dictionary <string, int>();
     mPresetToHotkeyMap.OnPresetToHotkeyMappingChanged += OnPresetHotkeyMapChanged;
     foreach (KeyValuePair <string, VirtualHotkey> presetAndHotkey in mPresetToHotkeyMap.GetHotkeyMappings())
     {
         RegisterHotkeyAndUpdateIdMapping(presetAndHotkey.Key, presetAndHotkey.Value);
     }
 }
Esempio n. 2
0
        public PresetHotkeyForm(DisplayPresetCollection displayPresetCollection, PresetToHotkeyMap presetToHotkeyMap)
        {
            InitializeComponent();

            mNewHotkey = new NewHotkey();

            mPresetToHotkeyMap = presetToHotkeyMap;
            mPresetToHotkeyDictionaryForComboBox = new Dictionary <string, VirtualHotkey>(mPresetToHotkeyMap.GetHotkeyMappings());
            mPresetToHotkeyMap.OnPresetToHotkeyMappingChanged += OnPresetToHotkeyMapChanged;

            presetsComboBox.Items.AddRange(displayPresetCollection.GetPresets().ToArray());
            presetsComboBox.SelectedIndexChanged += PresetsComboBox_SelectedIndexChanged;
            if (presetsComboBox.Items.Count > 0)
            {
                presetsComboBox.SelectedIndex = 0;
            }
        }