public static Task <IKeyEventArgs> UpAsync(this IHotkey sequenceUnit, int timeout = -1, string description = "", string stateTree = KeyStateTrees.Default) { var command = new KeyEventAsync(); sequenceUnit.OnUp(command.OnEvent, null, description, stateTree); return(command.WaitAsync(timeout)); }
/// <summary> /// register the key to the state tree, and wait the down event; /// timeout: return null /// </summary> public static Task <IKeyEventArgs> DownAsync(this IHotkey hotkey, int timeout = -1, string description = "", string stateTree = KeyStateTrees.Default) { var command = new KeyEventAsync(); hotkey.OnDown(command.OnEvent, null, description, stateTree); return(command.WaitAsync(timeout)); }