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


C# Engine.SetPath方法代码示例

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


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

示例1: SetPath

 private object SetPath(IDictionary<string, object> variables, string path, object value, Engine engine)
 {
     CodeTreeHelper.Print(new CodeTree().Compile(engine, CodeType.Set, path));
     var result = engine.SetPath(path, null, value);
     foreach (var name in variables.Keys) variables[name] = engine.GetVariable(name);
     return result;
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:7,代码来源:PathEvaluator.cs

示例2: OnGet

 protected override object OnGet(Engine engine)
 {
     if (Path != null && CodeTree.Compile(engine, CodeType.Get, Path).IsSetOrIncrement)
         return CodeTree.Get(engine);
     var value = engine.Get(ValueProperty, ValuePath, ValueCodeTree);
     if (Var != null)
     {
         var variable = engine.GetVariable(Var, VarCodeTree);
         if (Op != AssignmentOp.Assign)
         {
             var oldValue = engine.GetVariable(variable);
             value = engine.Operator(Op, oldValue, value);
         }
         engine.DefineVariableInParentScope(variable, value);
         return value;
     }
     if (IsBareTarget)
     {
         var target = engine.Get(TargetProperty);
         target = engine.Operator(Op, target, value);
         Target = value;
         return value;
     }
     var context = engine.Context;
     var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
     if (Op != AssignmentOp.Assign)
     {
         object oldValue = null;
         if (DependencyProperty != null)
             oldValue = PathHelper.GetDependencyProperty(engine, context as DependencyObject, DependencyProperty);
         else if (PropertyName != null)
             oldValue = PathHelper.GetProperty(engine, context, PropertyName);
         else if (FieldName != null)
             oldValue = PathHelper.GetField(engine, context, FieldName);
         else if (StaticPropertyName != null)
             oldValue = PathHelper.GetStaticProperty(engine, type, StaticPropertyName);
         else if (StaticFieldName != null)
             oldValue = PathHelper.GetStaticField(engine, type, StaticFieldName);
         else if (Path != null)
             oldValue = engine.GetPath(Path, CodeTree);
         else
             oldValue = context;
         value = engine.Operator(Op, oldValue, value);
     }
     if (DependencyProperty != null)
         PathHelper.SetDependencyProperty(engine, context as DependencyObject, DependencyProperty, value);
     else if (PropertyName != null)
         PathHelper.SetProperty(engine, context, PropertyName, value);
     else if (FieldName != null)
         PathHelper.SetField(engine, context, FieldName, value);
     else if (StaticPropertyName != null)
         PathHelper.SetStaticProperty(engine, type, StaticPropertyName, value);
     else if (StaticFieldName != null)
         PathHelper.SetStaticField(engine, type, StaticFieldName, value);
     else if (Path != null)
         engine.SetPath(Path, SetCodeTree, value);
     else
         Context = value;
     return value;
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:60,代码来源:Set.cs


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