public void Dispose() { if (_commandRef != default) { UtilitiesAPI.CommandEnd(_commandRef); _commandRef = default; } }
public CommandExecutionScope(CommandRef commandRef) { _commandRef = commandRef; if (_commandRef != default) { UtilitiesAPI.CommandBegin(_commandRef); } }
static int AfterExecuteCallback(CommandRef incommand, CommandPhase inphase, void *inrefcon) { if (_commandCache.TryGetValue(incommand, out var command) && command != null) { var args = new CommandAfterExecuteEventArgs(inphase); command._afterExecute?.Invoke(command, in args); } return(1); }
static int BeforeExecuteCallback(CommandRef incommand, CommandPhase inphase, void *inrefcon) { if (_commandCache.TryGetValue(incommand, out var command) && command != null) { var args = new CommandBeforeExecuteEventArgs(inphase); command._beforeExecute?.Invoke(command, ref args); return(args.Handled ? 0 : 1); } return(1); }
internal MenuItem Add(NormalMenuItem item, CommandRef commandRef) { if (_disposed) { throw new ObjectDisposedException(nameof(Menu)); } _itemList.Add(item); MenusAPI.AppendMenuItemWithCommand(_menuId, item.Name, commandRef); _lists.Add(item, this); return(item); }