/// <summary> /// Initializes the singleton instance of HotkeyRegistrar. /// </summary> /// <param name="presetToHotkeyMap">The mapping of presets to hotkeys.</param> /// <param name="messageFilter"></param> public static void Initialize(PresetToHotkeyMap presetToHotkeyMap) { if (mInstance == null) { mInstance = new HotkeyRegistrar(presetToHotkeyMap); } else { throw new Exception("Unexpected reinitialization of HotkeyRegistrar."); } }
/// <summary> /// Initializes global hotkey infrastructure. /// </summary> private void InitializeHotkey() { mMessageFilter = new HotkeyMessageFilter(); HotkeyRegistrar.Initialize(PresetToHotkeyMap.GetInstance()); HotkeyHandler.Initialize(PresetToHotkeyMap.GetInstance(), mMessageFilter); // Technically this can degrade performance, but we're not doing a ton of work in there. // Just have to make sure it's non-blocking. Application.AddMessageFilter(mMessageFilter); }