private void m_Provider_HotKeyPressed(object sender, HotKeyPressedEventArgs e) { if ( e.HotKey.Key == Key.F6) { //string oldtext = System.Windows.Clipboard.GetText(); InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_C); System.Threading.Thread.Sleep(50); string numToCall = System.Windows.Clipboard.GetText(); this.TxtNumToCall.Text = numToCall; //System.Windows.Clipboard.SetText(oldtext); } //else if (e.HotKey.ModifierKeys == (ModifierKeys.Alt | ModifierKeys.Control) && e.HotKey.Key == Key.F4) //{ // // MessageBox.Show("ctrl+alt+f4"); //} }
private void OnHotKeyPressed(int id) { Keys keyCombination = _hotKeys[id]; var args = new HotKeyPressedEventArgs(keyCombination); HotKeyPressed.SafeRaise(this, args); }
public static void SafeRaise(this HotKeyPressedEventHandler handler, object sender, HotKeyPressedEventArgs e) { if (handler != null) handler(sender, e); }
private void OnHotKeyHandlerWrapper(object sender, HotKeyPressedEventArgs e) { OnHotKeyHandler(sender, e); }
private bool OnHotKeyHandler(object sender, HotKeyPressedEventArgs e) { if (!this.Dispatcher.CheckAccess()) { this.Dispatcher.Invoke(new Func<object, HotKeyPressedEventArgs, bool>(OnHotKeyHandler), sender, e); return false; } KeyboardManager.KMKey key = e.Key; if (key.Equals(new KeyboardManager.KMKey(Key.NumLock, true, true, false))) { propagateExit = true; return true; } else if (key.Equals(new KeyboardManager.KMKey(Key.F9, true, true, false))) { if (leagueOfLegendsWindowHndl != IntPtr.Zero) // if we've already FOUND the LoL window... { WindowsApi.MoveWindowToSensibleLocation(leagueOfLegendsWindowHndl); return false; } } else if (key.Equals(new KeyboardManager.KMKey(Key.F10, true, true, false))) { if (leagueOfLegendsWindowHndl != IntPtr.Zero) // if we've already FOUND the LoL window... { KeyboardManager.Instance.SendAlliedChatMessage("test"); } } // konami code check if (konamiCode[konamiCodeSteps] == key.Key) { if (++konamiCodeSteps == konamiCode.Length) { konamiCodeSteps = 0; alwaysShowWindow = !alwaysShowWindow; SetStatusLine("KONAMI CODE HACKTIVATED"); this.Visibility = Visibility.Visible; this.Top = 0; this.Left = 0; this.Width = System.Windows.SystemParameters.FullPrimaryScreenWidth; this.Height = System.Windows.SystemParameters.FullPrimaryScreenHeight; } } else { konamiCodeSteps = 0; } if (this.Visibility != Visibility.Visible) return false; bool suppress = false; foreach (IUIElement iui in uiElements) { if (iui.GotKey(key)) suppress = true; } return suppress; }
private void _hotKeyHandler_HotKeyPressed(object sender, HotKeyPressedEventArgs e) { StatusChanged?.Invoke(this, new StatusChangedEventArgs("HotKey.", "", e.Socket, e.Status)); }
private void OnHotKeyPressed(object sender, HotKeyPressedEventArgs e) { try { HotKey hotKey = _hotKeys[e.KeyCombination]; foreach (var action in hotKey.Actions) action.Run(); } catch (Exception) { // // TODO: Add error handler // } }