本文整理汇总了C#中IEnvironment.GetVariable方法的典型用法代码示例。如果您正苦于以下问题:C# IEnvironment.GetVariable方法的具体用法?C# IEnvironment.GetVariable怎么用?C# IEnvironment.GetVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnvironment
的用法示例。
在下文中一共展示了IEnvironment.GetVariable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
public IQueryValue Evaluate(IEnvironment env)
{
IQueryValue value = env.GetVariable(Name);
switch (value.GetIQLType())
{
case IQLType.Canvas:
return Subexpression.Evaluate(new CanvasEnvironment(env, value.Canvas));
case IQLType.Color:
return Subexpression.Evaluate(new ColorEnvironment(env, value.Color));
default:
throw new InvalidOperationException(string.Format("Cannot create a context from type {0}", value.GetIQLType()));
}
}
示例2: Run
public void Run(IEnvironment env)
{
ICanvas canvas = env.GetVariable(CanvasName).Canvas;
Selection.Execute(env);
Unit[] units = Selection.Results();
CanvasSelectionEnvironment canvasEnv = new CanvasSelectionEnvironment(env, canvas);
foreach (var unit in units)
{
canvasEnv.X = unit.X;
canvasEnv.Y = unit.Y;
int x = XManipulation == null ? unit.X : (int) XManipulation.Evaluate(canvasEnv).Number;
int y = YManipulation == null ? unit.Y : (int) YManipulation.Evaluate(canvasEnv).Number;
canvas[x, y] = unit.Color;
}
}
示例3: Evaluate
public IQueryValue Evaluate(IEnvironment env)
{
IQueryValue value = env.GetVariable(Name);
return value.Index(X.Evaluate(env), Y == null ? null : Y.Evaluate(env));
}
示例4: Run
public void Run(IEnvironment env)
{
IQueryValue variable = env.GetVariable(Name);
variable.SetValue(Value.Evaluate(env));
}
示例5: Evaluate
public IQueryValue Evaluate(IEnvironment env)
{
return env.GetVariable(Name);
}