I want to perform two methods for different pressing of hot keys, checking in if-else what key was pressed
How to do this with this example?
I use so:
private static void Main()
{
HotKeyManager.RegisterHotKey(key: Keys.G, modifiers: HotKeyEventArgs.KeyModifiers.Alt);
HotKeyManager.HotKeyPressed += new EventHandler<HotKeyEventArgs>(HotKeyManager_HotKeyPressed);
Console.ReadLine();
}
private static void HotKeyManager_HotKeyPressed(object sender, HotKeyEventArgs e)
{
Console.WriteLine("Example HotKeys Activate");
}
How do I perform two different events with different HotKeys?
You need to register all your hotkey and then can use the
Key
andModifiers
properties of theHotKeyEventArgs
: