コード例 #1
0
        public int Exec(ref Guid guidCommandGroup, uint commandID, uint commandExecOpt, IntPtr variantIn, IntPtr variantOut)
        {
            // Cache the variants, they'll be needed if the command chain
            // goes back into another IOleCommandTarget (see CommandTargetToOleShim)
            CommandResult result;

            try {
                _variantStacks?.Push(variantIn, variantOut, false);

                var inputArg = TranslateInputArg(ref guidCommandGroup, commandID, variantIn);

                object outputArg = null;
                result = _commandTarget.Invoke(guidCommandGroup, (int)commandID, inputArg, ref outputArg);

                if (outputArg != null && variantOut != IntPtr.Zero)
                {
                    Marshal.GetNativeVariantForObject(outputArg, variantOut);
                }
            } catch (Exception) {
                // Some ICommandTarget object is throwing an exception, which will propagate out as a failed hr, which
                //   isn't particularly easy to track down. Put a bit of exception information in the activity log.
                //ActivityLog.LogInformation("R Tools", exc.ToString());

                //string logPath = ActivityLog.LogFilePath; // This actually flushes the activity log buffer

                throw;
            } finally {
                _variantStacks?.Pop();
            }

            return(OleCommand.MakeOleResult(result));
        }
コード例 #2
0
        public CommandResult Invoke(ICommandTarget commandTarget, Guid group, int id, object inputArg, ref object outputArg)
        {
            CommandResult result;

            try {
                _variantStacks?.Push(IntPtr.Zero, IntPtr.Zero, true);
                result = commandTarget.Invoke(group, id, inputArg, ref outputArg);
            } finally {
                _variantStacks?.Pop();
            }
            return(result);
        }
コード例 #3
0
        public override CommandResult Invoke(Guid group, int id, object inputArg, ref object outputArg)
        {
            switch (Keyboard.Modifiers)
            {
            case ModifierKeys.None:
                return(_sendToReplCommand.Invoke(group, id, inputArg, ref outputArg));

            case ModifierKeys.Shift:
                return(_sendToSourceCommand.Invoke(group, id, inputArg, ref outputArg));

            default:
                return(CommandResult.NotSupported);
            }
        }
コード例 #4
0
 public CommandResult Invoke(Guid group, int id, object inputArg, ref object outputArg)
 {
     return(_commandTarget != null?_commandTarget.Invoke(group, id, inputArg, ref outputArg) : CommandResult.NotSupported);
 }
コード例 #5
0
        public CommandResult Invoke(ICommandTarget commandTarget, Guid group, int id, object inputArg, ref object outputArg) {
            CommandResult result;
            try {
                if (_variantStacks != null)
                    _variantStacks.Push(IntPtr.Zero, IntPtr.Zero, true);

                result = commandTarget.Invoke(group, id, inputArg, ref outputArg);
            } finally {
                if (_variantStacks != null)
                    _variantStacks.Pop();
            }

            return result;
        }