예제 #1
0
 public void Dispose()
 {
     if (_commandRef != default)
     {
         UtilitiesAPI.CommandEnd(_commandRef);
         _commandRef = default;
     }
 }
예제 #2
0
 public CommandExecutionScope(CommandRef commandRef)
 {
     _commandRef = commandRef;
     if (_commandRef != default)
     {
         UtilitiesAPI.CommandBegin(_commandRef);
     }
 }
예제 #3
0
            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);
            }
예제 #4
0
            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);
            }
예제 #5
0
        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);
        }