• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ExecutionContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ExecutionContext的典型用法代码示例。如果您正苦于以下问题:C# ExecutionContext类的具体用法?C# ExecutionContext怎么用?C# ExecutionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExecutionContext类属于命名空间,在下文中一共展示了ExecutionContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetUsingValue

 private static object GetUsingValue(MutableTuple tuple, int index, ExecutionContext context)
 {
     UsingResult usingValueFromTuple = GetUsingValueFromTuple(tuple, index);
     if (usingValueFromTuple != null)
     {
         return usingValueFromTuple.Value;
     }
     for (SessionStateScope scope = context.EngineSessionState.CurrentScope; scope != null; scope = scope.Parent)
     {
         usingValueFromTuple = GetUsingValueFromTuple(scope.LocalsTuple, index);
         if (usingValueFromTuple != null)
         {
             return usingValueFromTuple.Value;
         }
         foreach (MutableTuple tuple2 in scope.DottedScopes)
         {
             usingValueFromTuple = GetUsingValueFromTuple(tuple2, index);
             if (usingValueFromTuple != null)
             {
                 return usingValueFromTuple.Value;
             }
         }
     }
     throw InterpreterError.NewInterpreterException(null, typeof(RuntimeException), null, "UsingWithoutInvokeCommand", ParserStrings.UsingWithoutInvokeCommand, new object[0]);
 }
开发者ID:nickchal,项目名称:pash,代码行数:25,代码来源:VariableOps.cs


示例2: Execute

 public override object Execute(object[] args, ExecutionContext ctx)
 {
     ArgumentChecker checker = new ArgumentChecker(this.GetType().Name);
     checker.CheckForNumberOfArguments(ref args, 1, null);
     decimal d = Convert.ToDecimal(args[0]);
     return Math.Sign(d) * Math.Floor(Math.Abs(d));
 }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:7,代码来源:IntFunction.cs


示例3: ExecuteAsync

        public IObservable<Unit> ExecuteAsync(ExecutionContext context)
        {
            context.AssertNotNull(nameof(context));

            var childExecutions = this
                .children
                .Select(
                    child => Observable
                        .Return(Unit.Default)
                        .Select(
                            _ =>
                            {
                                context.CancellationToken.ThrowIfCancellationRequested();
                                var execute = true;

                                if (context.SkipAhead > TimeSpan.Zero && context.SkipAhead >= child.Duration)
                                {
                                    context.AddProgress(child.Duration);
                                    execute = false;
                                }

                                return new
                                {
                                    Child = child,
                                    Execute = execute
                                };
                            })
                        .Where(x => x.Execute)
                        .SelectMany(x => x.Child.ExecuteAsync(context)))
                .DefaultIfEmpty(Observable.Return(Unit.Default));

            return Observable
                .Concat(childExecutions)
                .RunAsync(context.CancellationToken);
        }
开发者ID:reactiveui-forks,项目名称:WorkoutWotch,代码行数:35,代码来源:SequenceAction.cs


示例4: execute_executes_each_child_action

        public void execute_executes_each_child_action()
        {
            var action1 = new ActionMock(MockBehavior.Loose);
            var action2 = new ActionMock(MockBehavior.Loose);
            var action3 = new ActionMock(MockBehavior.Loose);
            var sut = new SequenceActionBuilder()
                .WithChild(action1)
                .WithChild(action2)
                .WithChild(action3)
                .Build();

            using (var context = new ExecutionContext())
            {
                sut.Execute(context).Subscribe();

                action1
                    .Verify(x => x.Execute(context))
                    .WasCalledExactlyOnce();

                action2
                    .Verify(x => x.Execute(context))
                    .WasCalledExactlyOnce();

                action3
                    .Verify(x => x.Execute(context))
                    .WasCalledExactlyOnce();
            }
        }
开发者ID:gregjones60,项目名称:WorkoutWotch,代码行数:28,代码来源:SequenceActionFixture.cs


示例5: Execute

        public override void Execute(ExecutionContext context)
        {
            if (context.CurrentBlockWeb != null && ownerBlockId == null)
            {
                throw new Exception("You cannot nest standalone blockWebs");
            }

            IBlockWeb newWeb = null;
            IBlockWeb oldWeb = context.CurrentBlockWeb;

            if (ownerBlockId != null)
            {
                newWeb = (IBlockWeb)context.CurrentBlockWeb[ownerBlockId].ProcessRequest("ProcessMetaService", BlockMetaServiceType.GetInnerWeb,
                    null, null);
            }
            else
            {
                newWeb = new BlockWeb(webId, context.Broker);
            }

            context.CurrentBlockWeb = newWeb;

            if (webId != null)
            {
                context.blockWebs[webId] = newWeb;
            }

            base.Execute(context);

            context.CurrentBlockWeb = oldWeb;
        }
开发者ID:mm-binary,项目名称:DARF,代码行数:31,代码来源:BlockWebNode.cs


示例6: DefaultCtorSplitsAtDashes

        public void DefaultCtorSplitsAtDashes()
        {
            // Given
            Engine engine = new Engine();
            Metadata metadata = new Metadata(engine);
            Pipeline pipeline = new Pipeline("Pipeline", engine, null);
            IExecutionContext context = new ExecutionContext(engine, pipeline);
            IDocument[] inputs = { new Document(metadata).Clone(@"FM1
            FM2
            ---
            Content1
            Content2") };
            string frontMatterContent = null;
            FrontMatter frontMatter = new FrontMatter(new Execute(x =>
            {
                frontMatterContent = x.Content;
                return new [] {x};
            }));

            // When
            IEnumerable<IDocument> documents = frontMatter.Execute(inputs, context);

            // Then
            Assert.AreEqual(1, documents.Count());
            Assert.AreEqual(@"FM1
            FM2
            ", frontMatterContent);
            Assert.AreEqual(@"Content1
            Content2", documents.First().Content);
        }
开发者ID:Rohansi,项目名称:Wyam,代码行数:30,代码来源:FrontMatterFixture.cs


示例7: Execute

 public override object Execute(object[] args, ExecutionContext ctx)
 {
     ArgumentChecker checker = new ArgumentChecker(this.GetType().Name);
     checker.CheckForNumberOfArguments(ref args, 1, null);
     CharMapAlphabet map = new CharMapAlphabet();
     return map.GetCharacterCode(args[0].ToString()[0]);
 }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:7,代码来源:AlphaPos.cs


示例8: ExecuteStatement

        protected override void ExecuteStatement(ExecutionContext context)
        {
            var evaluated = Password.EvaluateToConstant(context.Request, null);
            var passwordText = evaluated.AsVarChar().Value.ToString();

            context.Request.Query.CreateUser(UserName, passwordText);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:7,代码来源:CreateUserStatement.cs


示例9: RegisterCommandDefault

 private void RegisterCommandDefault(ExecutionContext context, string commandName, Type commandType)
 {
     CommandEntry entry = new CommandEntry();
     entry.command.Initialize(context, commandName, commandType);
     entry.command.AddNamedParameter("LineOutput", this.lo);
     this.defaultCommandEntry = entry;
 }
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:SubPipelineManager.cs


示例10: GetValidRules

 public virtual IEnumerable<ILogicRuleObject> GetValidRules(View view,  ExecutionContext executionContext) {
     if (view!=null) {
         var tuple = new Tuple<ITypeInfo, ExecutionContext>(view.ObjectTypeInfo, executionContext);
         return LogicRuleManager.Instance[tuple].Where(rule => IsValidRule(rule, view)).OrderBy(rule => rule.Index);
     }
     return Enumerable.Empty<ILogicRuleObject>();
 }
开发者ID:noxe,项目名称:eXpand,代码行数:7,代码来源:LogicRuleEvaluator.cs


示例11: ConfigureSecurity

 protected override void ConfigureSecurity(ExecutionContext context)
 {
     context.Assertions.Add(c => {
         if (!c.User.CanManageUsers())
             throw new SecurityException(String.Format("User '{0}' cannot create users.", c.User.Name));
     });
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:CreateUserStatement.cs


示例12: DefaultCtorIgnoresDelimiterOnFirstLine

            public void DefaultCtorIgnoresDelimiterOnFirstLine()
            {
                // Given
                Engine engine = new Engine();
                Pipeline pipeline = new Pipeline("Pipeline", null);
                IExecutionContext context = new ExecutionContext(engine, pipeline);
                IDocument[] inputs =
                {
                    context.GetDocument(@"---
                FM1
                FM2
                ---
                Content1
                Content2")
                };
                string frontMatterContent = null;
                FrontMatter frontMatter = new FrontMatter(new Execute((x, ctx) =>
                {
                    frontMatterContent = x.Content;
                    return new[] {x};
                }));

                // When
                IEnumerable<IDocument> documents = frontMatter.Execute(inputs, context);

                // Then
                Assert.AreEqual(1, documents.Count());
                Assert.AreEqual(@"FM1
                FM2
                ", frontMatterContent);
                Assert.AreEqual(@"Content1
                Content2", documents.First().Content);
            }
开发者ID:ryanrousseau,项目名称:Wyam,代码行数:33,代码来源:FrontMatterTests.cs


示例13: TestConstruction

        public static void TestConstruction()
        {
            AssertEquals(new Literal(false).AsValue(), false);
            AssertEquals(new Literal(true).AsValue(), true);

            AssertEquals(new Literal(0).AsValue(), 0);
            AssertEquals(new Literal(1).AsValue(), 1);
            AssertEquals(new Literal(5).AsValue(), 5);

            AssertEquals(new Literal(0.1f).AsValue(), 0.1f);
            AssertEquals(new Literal(2.4f).AsValue(), 2.4f);
            AssertEquals(new Literal(5.0f).AsValue(), 5.0f);

            AssertEquals(new Literal("Hello ").AsValue(), "Hello ");
            AssertEquals(new Literal("World!").AsValue(), "World!");

            AssertEquals(new Literal(new Literal(true)).AsValue(), true);
            AssertEquals(new Literal(new Literal(1)).AsValue(), 1);
            AssertEquals(new Literal(new Literal(2.4f)).AsValue(), 2.4f);
            AssertEquals(new Literal(new Literal("Hello ")).AsValue(), "Hello ");

            var context = new ExecutionContext(new Python3Calculator());
            AssertEquals(new Variable("foo", context).Type, ValueType.ANY);
            AssertEquals(new Variable(ValueType.BOOL, "bar", context).Type, ValueType.BOOL);

            AssertException<InvalidOperationException>(() => new Variable("foo", context));
        }
开发者ID:exodrifter,项目名称:unity-expression-parser,代码行数:27,代码来源:ValueTestSuite.cs


示例14: GetVariableAsRef

 private static PSReference GetVariableAsRef(VariablePath variablePath, ExecutionContext executionContext, Type staticType)
 {
     SessionStateScope scope;
     SessionStateInternal engineSessionState = executionContext.EngineSessionState;
     CommandOrigin scopeOrigin = engineSessionState.CurrentScope.ScopeOrigin;
     PSVariable variable = engineSessionState.GetVariableItem(variablePath, out scope, scopeOrigin);
     if (variable == null)
     {
         throw InterpreterError.NewInterpreterException(variablePath, typeof(RuntimeException), null, "NonExistingVariableReference", ParserStrings.NonExistingVariableReference, new object[0]);
     }
     object obj2 = variable.Value;
     if ((staticType == null) && (obj2 != null))
     {
         obj2 = PSObject.Base(obj2);
         if (obj2 != null)
         {
             staticType = obj2.GetType();
         }
     }
     if (staticType == null)
     {
         ArgumentTypeConverterAttribute attribute = variable.Attributes.OfType<ArgumentTypeConverterAttribute>().FirstOrDefault<ArgumentTypeConverterAttribute>();
         staticType = (attribute != null) ? attribute.TargetType : typeof(LanguagePrimitives.Null);
     }
     return PSReference.CreateInstance(variable, staticType);
 }
开发者ID:nickchal,项目名称:pash,代码行数:26,代码来源:VariableOps.cs


示例15: Divide

        internal override ElaValue Divide(ElaValue left, ElaValue right, ExecutionContext ctx)
        {
            if (right.TypeId != ElaMachine.REA)
            {
                if (right.TypeId == ElaMachine.DBL)
                    return new ElaValue(left.DirectGetSingle() / right.Ref.AsDouble());
                else if (right.TypeId == ElaMachine.INT)
                    return new ElaValue(left.DirectGetSingle() / right.I4);
                else if (right.TypeId == ElaMachine.LNG)
                    return new ElaValue(left.DirectGetSingle() / right.Ref.AsLong());
                else
                {
                    NoOverloadBinary(TCF.SINGLE, right, "divide", ctx);
                    return Default();
                }
            }

            if (right.DirectGetSingle() == 0)
            {
                ctx.DivideByZero(left);
                return Default();
            }

            return new ElaValue(left.DirectGetSingle() / right.DirectGetSingle());
        }
开发者ID:rizwan3d,项目名称:elalang,代码行数:25,代码来源:SingleInstance.cs


示例16: OnExecute

        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            sweepAngle = Values[Resources.LenticularSweepAngle].Value * Math.PI / 180;
            interlaceCount = (int) Values[Resources.LenticularInterlaceCount].Value;
            interlaceWidth = (int) Values[Resources.LenticularInterlaceWidth].Value;

            SaveFileDialog dialog = new SaveFileDialog();
            dialog.Filter = "PNG Files (*.png)|*.png";
            DialogResult result = dialog.ShowDialog();

            if (result != DialogResult.OK)
                return;

            fileName = dialog.FileName;

            activeWindow = Window.ActiveWindow;
            originalWindowTrans = activeWindow.Projection;
            screenY = Line.Create(Point.Origin, originalWindowTrans.Inverse * Direction.DirY);

            string file = GetEnumeratedFileName(0);
            activeWindow.Export(WindowExportFormat.Png, file);
            Bitmap bitmap = (Bitmap) Bitmap.FromFile(file);

            width = bitmap.Width;
            height = bitmap.Height;
        }
开发者ID:bcourter,项目名称:SpaceClaim-Addins-Experimental,代码行数:26,代码来源:Lenticular.cs


示例17: DashStringDoesNotSplitAtNonmatchingDashes

        public void DashStringDoesNotSplitAtNonmatchingDashes()
        {
            // Given
            Engine engine = new Engine();
            Metadata metadata = new Metadata(engine);
            Pipeline pipeline = new Pipeline("Pipeline", engine, null);
            IExecutionContext context = new ExecutionContext(engine, pipeline);
            IDocument[] inputs = { new Document(metadata).Clone(@"FM1
            FM2
            ---
            Content1
            Content2") };
            bool executed = false;
            FrontMatter frontMatter = new FrontMatter("-", new Execute(x =>
            {
                executed = true;
                return new[] { x };
            }));

            // When
            IEnumerable<IDocument> documents = frontMatter.Execute(inputs, context);

            // Then
            Assert.AreEqual(1, documents.Count());
            Assert.IsFalse(executed);
            Assert.AreEqual(@"FM1
            FM2
            ---
            Content1
            Content2", documents.First().Content);
        }
开发者ID:Rohansi,项目名称:Wyam,代码行数:31,代码来源:FrontMatterFixture.cs


示例18: Execute

        public IObservable<Unit> Execute(ExecutionContext context)
        {
            Ensure.ArgumentNotNull(context, nameof(context));

            var childExecutions = this
                .children
                .Select(
                    child => Observable
                        .Return(Unit.Default)
                        .Select(
                            _ =>
                            {
                                var execute = true;

                                if (context.SkipAhead > TimeSpan.Zero && context.SkipAhead >= child.Duration)
                                {
                                    context.AddProgress(child.Duration);
                                    execute = false;
                                }

                                return new
                                {
                                    Child = child,
                                    Execute = execute
                                };
                            })
                        .Where(x => x.Execute)
                        .SelectMany(x => x.Child.Execute(context)));

            return Observable
                .Concat(childExecutions)
                .DefaultIfEmpty();
        }
开发者ID:gregjones60,项目名称:WorkoutWotch,代码行数:33,代码来源:SequenceAction.cs


示例19: Execute

        public override object Execute(object[] args, ExecutionContext ctx)
        {
            ArgumentChecker checker = new ArgumentChecker(this.GetType().Name);
            if (!string.IsNullOrEmpty(Settings.Settings.Default.ActiveGeocacheCode))
            {
                string codeToSearch = (args.Length == 0)
                    ? Settings.Settings.Default.ActiveGeocacheCode
                    : args[0].ToString();

                if (codeToSearch.Length == 0)
                {
                    codeToSearch = Settings.Settings.Default.ActiveGeocacheCode;
                }

                // Geocache Code
                if (codeToSearch == Settings.Settings.Default.ActiveGeocacheCode)
                {
                    return GetGeocachePostion(Settings.Settings.Default.ActiveGeocacheCode);
                }

                // Waypoints
                return GetWaypointPostion(codeToSearch);
            }
            return "";
        }
开发者ID:GlobalcachingEU,项目名称:GSAKWrapper,代码行数:25,代码来源:Waypoint.cs


示例20: ScriptBlockParameterBinder

 internal ScriptBlockParameterBinder(ReadOnlyCollection<ParameterAst> scriptParameters, ExecutionContext context,
                                     ExecutionVisitor executionVisitor)
 {
     _scriptParameters = scriptParameters;
     _executionContext = context;
     _executionVisitor = executionVisitor;
 }
开发者ID:mauve,项目名称:Pash,代码行数:7,代码来源:ScriptBlockParameterBinder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ExecutionState类代码示例发布时间:2022-05-24
下一篇:
C# ExecutedRoutedEventHandler类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap