private void HandleMacro(HOTASButton button, int offset) { if (_activeMacros.TryGetValue(offset, out _)) { //cancel a macro already in progress _activeMacros.TryRemove(offset, out _); MacroCancelled?.Invoke(this, new MacroCancelledEventArgs(offset, (int)Win32Structures.ScanCodeShort.MACRO_CANCELLED)); return; } _activeMacros.TryAdd(offset, true); Task.Run(() => PlayMacroOnce(offset, button.ActionCatalogItem.Actions)); }
private void Device_MacroCancelled(object sender, MacroCancelledEventArgs e) { MacroCancelled?.Invoke(sender, e); }