当前位置: 首页>>代码示例>>C#>>正文


C# Engine.Trace方法代码示例

本文整理汇总了C#中Engine.Trace方法的典型用法代码示例。如果您正苦于以下问题:C# Engine.Trace方法的具体用法?C# Engine.Trace怎么用?C# Engine.Trace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Engine的用法示例。


在下文中一共展示了Engine.Trace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

 public object Get(Engine engine)
 {
     engine.Trace(TraceFlags.Path, "Path: {0}: Get", this.GetType().Name);
     var result = OnGet(engine);
     engine.Trace(TraceFlags.Path, "Path: {0} = {1}", this.GetType().Name, result);
     return result;
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:7,代码来源:ExpressionNode.cs

示例2: CallMethod

 public static object CallMethod(string methodName, bool staticMethod, Type typeToCall, object callee, IEnumerable<object> args, Type[] typeArgs, Engine engine)
 {
     var bindingFlags = (staticMethod ? BindingFlags.Static : BindingFlags.Instance) |
         BindingFlags.Public | BindingFlags.FlattenHierarchy;
     var methodInfo = null as MethodInfo;
     if (typeArgs != null)
     {
         // Use type arguments to choose overload.
         methodInfo = typeToCall.GetMethod(methodName, bindingFlags, null, typeArgs, null);
     }
     else
     {
         // Look for a matching method.
         var candidates = typeToCall.GetMethods(bindingFlags).Where(info => info.Name == methodName);
         var count = candidates.Count();
         if (count >= 1)
         {
             if (count == 1)
                 methodInfo = candidates.First();
             else
             {
                 // Use arguments to choose overload.
                 var types = args.Select(value => value != null ? value.GetType() : typeof(object));
                 methodInfo = typeToCall.GetMethod(methodName, bindingFlags, null, types.ToArray(), null);
                 if (methodInfo == null) engine.Throw("method overload not found: " + methodName);
             }
         }
     }
     if (methodInfo == null) engine.Throw("method not found: " + methodName);
     var parameters = methodInfo.GetParameters();
     var methodArgs = null as object[];
     if (HasParamsParameter(parameters))
     {
         var m = parameters.Length - 1;
         var initiaArgs = ConvertArguments(parameters.Take(m), args.Take(m));
         var paramsType = parameters[m].ParameterType.GetElementType();
         var remainingArgs = TypeHelper.CreateArray(args.Skip(m).ToArray(), paramsType);
         methodArgs = initiaArgs.Concat(new object[] { remainingArgs }).ToArray();
     }
     else
     {
         if (parameters.Length != args.Count()) engine.Throw("argument count mismatch: {0} != {1}", parameters.Length, args.Count());
         methodArgs = ConvertArguments(parameters, args).ToArray();
     }
     bool trace = engine.ShouldTrace(TraceFlags.Call);
     if (trace)
     {
         TraceCall("args", methodName, args, engine);
         TraceCall("methodArgs", methodName, methodArgs, engine);
     }
     var result = methodInfo.Invoke(callee, methodArgs);
     if (trace) engine.Trace(TraceFlags.Call, "Call {0} = {1}", methodName, result);
     return result;
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:54,代码来源:CallHelper.cs

示例3: EventHandler

 private void EventHandler(Engine engine)
 {
     if (Configuration.IsInDesignMode) return;
     engine.Trace(TraceFlags.Events, "Event: {0}, sender {1}", registeredEventName, engine.Sender);
     SetContext(engine);
     OnEventHandler(engine);
     #if !SILVERLIGHT
     if (!Configuration.Silverlight && SetHandled && engine.EventArgs is RoutedEventArgs)
         (engine.EventArgs as RoutedEventArgs).Handled = true;
     #endif
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:11,代码来源:Handler.cs

示例4: TraceCall

 private static void TraceCall(string info, string methodName, IEnumerable<object> args, Engine engine)
 {
     var text = args.Count() == 0 ? "" : args.Aggregate((current, next) => current + ", " + next);
     engine.Trace(TraceFlags.Call, "Call {0}: {1}({2})", info, methodName, text);
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:5,代码来源:CallHelper.cs

示例5: Set

 public object Set(Engine engine, object value)
 {
     engine.Trace(TraceFlags.Path, "Path: {0}: Set {1}", this.GetType().Name, value);
     OnSet(engine, value);
     return value;
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:6,代码来源:ExpressionNode.cs


注:本文中的Engine.Trace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。