コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <summary>
 /// Event handler for when "Edit global hotkeys" context menu item is clicked. Launches
 /// a form to allow the user to edit global hotkeys for the display presets.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void EditGlobalHotkeys_ItemClicked(object sender, EventArgs e)
 {
     if (mPresetHotkeyForm == null)
     {
         mPresetHotkeyForm             = new PresetHotkeyForm(DisplayPresetCollection.GetDisplayPresetCollection(), PresetToHotkeyMap.GetInstance());
         mPresetHotkeyForm.FormClosed += MPresetHotkeyForm_FormClosed;
     }
     else if (!mPresetHotkeyForm.Visible)
     {
         mPresetHotkeyForm.ShowDialog();
     }
     else
     {
         mPresetHotkeyForm.Activate();
     }
 }