/// <summary> /// Evaluates the current expression. /// </summary> /// <param name="context">The context of the evaluation.</param> /// <param name="res">The variable which will contain the result of the evaluation.</param> protected override void Evaluate(EvaluationContext context, out EvaluationResult res) { Commands.Command cmd = null; if (context.State != null) { cmd = context.State.GetCommand(CommandName); } if (cmd == null) { cmd = context.Host.GetCommand(CommandName); } if (cmd == null) { res = new EvaluationResult(CommonStatusCodes.CommandNotFound, this , string.Format(CultureInfo.InvariantCulture , "Command not found: {0}" , CommandName) , this.CommandName); return; } res = cmd.Invoke(Toggle, context, args_a ?? args.ToArray()); res.Expression = this; }