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

C# ActivityInstance类代码示例

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

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



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

示例1: InternalExecute

        void InternalExecute(NativeActivityContext context, ActivityInstance completedInstance)
        {
            CompensationExtension compensationExtension = context.GetExtension<CompensationExtension>();
            if (compensationExtension == null)
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.ConfirmWithoutCompensableActivity(this.DisplayName)));
            }

            CompensationToken token = Target.Get(context);
            CompensationTokenData tokenData = token == null ? null : compensationExtension.Get(token.CompensationId);

            Fx.Assert(tokenData != null, "CompensationTokenData must be valid");

            if (tokenData.ExecutionTracker.Count > 0)
            {
                if (this.onChildConfirmed == null)
                {
                    this.onChildConfirmed = new CompletionCallback(InternalExecute);
                }

                this.toConfirmToken.Set(context, new CompensationToken(tokenData.ExecutionTracker.Get()));

                Fx.Assert(Body != null, "Body must be valid");
                context.ScheduleActivity(Body, this.onChildConfirmed);
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:DefaultConfirmation.cs


示例2: GatherOutputs

        protected override void GatherOutputs(ActivityInstance completedInstance)
        {
            if (completedInstance.Activity.HandlerOf != null)
            {
                IList<RuntimeDelegateArgument> runtimeArguments = completedInstance.Activity.HandlerOf.RuntimeDelegateArguments;
                LocationEnvironment environment = completedInstance.Environment;

                for (int i = 0; i < runtimeArguments.Count; i++)
                {
                    RuntimeDelegateArgument runtimeArgument = runtimeArguments[i];

                    if (runtimeArgument.BoundArgument != null)
                    {
                        if (ArgumentDirectionHelper.IsOut(runtimeArgument.Direction))
                        {
                            Location parameterLocation = environment.GetSpecificLocation(runtimeArgument.BoundArgument.Id);

                            if (parameterLocation != null)
                            {
                                if (this.results == null)
                                {
                                    this.results = new Dictionary<string, object>();
                                }

                                this.results.Add(runtimeArgument.Name, parameterLocation.Value);
                            }
                        }
                    }
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:31,代码来源:DelegateCompletionCallbackWrapper.cs


示例3: CreateWorkItem

        internal WorkItem CreateWorkItem(ActivityInstance completedInstance, ActivityExecutor executor)
        {
            // We use the property to guard against the virtual method call
            // since we don't need it in the common case
            if (this.NeedsToGatherOutputs)
            {
                this.GatherOutputs(completedInstance);
            }

            CompletionWorkItem workItem;

            if (this.checkForCancelation)
            {
                workItem = new CompletionWithCancelationCheckWorkItem(this, completedInstance);
            }
            else
            {
                workItem = executor.CompletionWorkItemPool.Acquire();
                workItem.Initialize(this, completedInstance);
            }

            if (completedInstance.InstanceMap != null)
            {
                completedInstance.InstanceMap.AddEntry(workItem);
            }

            return workItem;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:28,代码来源:CompletionCallbackWrapper.cs


示例4: BookmarkCallbackWrapper

        public BookmarkCallbackWrapper(BookmarkCallback callback, ActivityInstance owningInstance, BookmarkOptions bookmarkOptions)
            : base(callback, owningInstance)
        {
            Fx.Assert(callback != null || bookmarkOptions == BookmarkOptions.None, "Either we have a callback or we only allow SingleFire, Blocking bookmarks.");

            this.Options = bookmarkOptions;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:BookmarkCallbackWrapper.cs


示例5: ActivityCompleted

 public void ActivityCompleted(ActivityInstance activityInstance)
 {
     if (!(activityInstance.Activity.RootActivity is Constraint)) // Don't debug an activity in a Constraint
     {
         EnsureActivityInstrumented(activityInstance, true);
         this.debugManager.OnLeaveState(activityInstance);
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:DebugController.cs


示例6: FaultWorkItem

 public FaultWorkItem(FaultCallbackWrapper callbackWrapper, Exception propagatedException, ActivityInstance propagatedFrom, ActivityInstanceReference originalExceptionSource)
     : base(callbackWrapper.ActivityInstance)
 {
     this.callbackWrapper = callbackWrapper;
     this.propagatedException = propagatedException;
     this.propagatedFrom = propagatedFrom;
     this.originalExceptionSource = originalExceptionSource;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:FaultCallbackWrapper.cs


示例7: Initialize

 public void Initialize(ActivityInstance activityInstance, int nextArgumentIndex, IDictionary<string, object> argumentValueOverrides, Location resultLocation)
 {
     Fx.Assert(nextArgumentIndex > 0, "The nextArgumentIndex must be greater than 0 otherwise we will incorrectly set the sub-state when ResolveArguments completes");
     base.Reinitialize(activityInstance);
     this.nextArgumentIndex = nextArgumentIndex;
     this.argumentValueOverrides = argumentValueOverrides;
     this.resultLocation = resultLocation;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:ResolveNextArgumentWorkItem.cs


示例8: ActivityStarted

 public void ActivityStarted(ActivityInstance activityInstance)
 {
     if (!(activityInstance.Activity.RootActivity is Constraint))  // Don't debug an activity in a Constraint
     {
         EnsureActivityInstrumented(activityInstance, false);
         this.debugManager.OnEnterState(activityInstance);
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:DebugController.cs


示例9: CancelRequestedRecord

 internal CancelRequestedRecord(Guid instanceId, ActivityInstance instance, ActivityInstance child)
     : base(instanceId)
 {
     Fx.Assert(child != null, "Child activity instance cannot be null.");
     if (instance != null)
     {
         this.Activity = new ActivityInfo(instance);
     }
     this.Child = new ActivityInfo(child);            
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:CancelRequestedRecord.cs


示例10: ActivityScheduledRecord

 internal ActivityScheduledRecord(Guid instanceId, ActivityInstance instance, ActivityInfo child)
     : base(instanceId)
 {
     Fx.Assert(child != null, "Child activity cannot be null.");
     if (instance != null)
     {
         this.Activity = new ActivityInfo(instance);
     }
     this.Child = child;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:10,代码来源:ActivityScheduledRecord.cs


示例11: OnHasCompleted

        protected override void OnHasCompleted(NativeActivityContext context, ActivityInstance completedInstance)
        {
            base.OnHasCompleted(context, completedInstance);

            //HACK:重写并行节点满足条件退出逻辑
            var e = context.GetExtension<ParallelExtension>();
            e.Cancelled(context.GetChildren()
                .Where(o => o.ID != completedInstance.ID)
                .Select(o => o.ID)
                .ToArray());
        }
开发者ID:jatinbhole,项目名称:NTFE-BPM,代码行数:11,代码来源:CustomParallel.cs


示例12: Register

        public void Register(Location location, Activity activity, LocationReference locationOwner, ActivityInstance activityInstance)
        {
            Fx.Assert(location.CanBeMapped, "should only register mappable locations");

            if (this.mappableLocations == null)
            {
                this.mappableLocations = new List<MappableLocation>();
            }

            this.mappableLocations.Add(new MappableLocation(locationOwner, activity, activityInstance, location));
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:11,代码来源:MappableObjectManager.cs


示例13: Initialize

        /// <summary>
        /// Called each time a work item is acquired from the pool
        /// </summary>
        /// <param name="parentInstance">The ActivityInstance containin the variable or argument that contains this expression</param>
        /// <param name="expressionActivity">The expression to evaluate</param>
        /// <param name="instanceId">The ActivityInstanceID to use for expressionActivity</param>
        /// <param name="resultLocation">Location where the result of expressionActivity should be placed</param>
        /// <param name="nextArgumentWorkItem">WorkItem to execute after this one</param>
        public void Initialize(ActivityInstance parentInstance, ActivityWithResult expressionActivity, long instanceId, Location resultLocation, ResolveNextArgumentWorkItem nextArgumentWorkItem)
        {
            this.Reinitialize(parentInstance);

            Fx.Assert(resultLocation != null, "We should only use this work item when we are resolving arguments/variables and therefore have a result location.");
            Fx.Assert(expressionActivity.IsFastPath, "Should only use this work item for fast path expressions");

            this.expressionActivity = expressionActivity;
            this.instanceId = instanceId;
            this.resultLocation = resultLocation;
            this.nextArgumentWorkItem = nextArgumentWorkItem;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:20,代码来源:ExecuteSynchronousExpressionWorkItem.cs


示例14: Invoke

        protected internal override void Invoke(NativeActivityContext context, ActivityInstance completedInstance)
        {
            EnsureCallback(callbackType, callbackParameterTypes);
            DelegateCompletionCallback completionCallback = (DelegateCompletionCallback)this.Callback;

            IDictionary<string, object> returnValue = this.results;

            if (returnValue == null)
            {
                returnValue = ActivityUtilities.EmptyParameters;
            }

            completionCallback(context, completedInstance, returnValue);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:DelegateCompletionCallbackWrapper.cs


示例15: FaultPropagationRecord

        internal FaultPropagationRecord(Guid instanceId, ActivityInstance source, ActivityInstance faultHandler, bool isFaultSource, Exception fault)
            : base(instanceId)
        {
            Fx.Assert(source != null, "Fault source cannot be null");
            this.FaultSource = new ActivityInfo(source);

            if (faultHandler != null)
            {
                this.FaultHandler = new ActivityInfo(faultHandler);
            }
            this.IsFaultSource = isFaultSource;
            this.Fault = fault;
            this.Level = TraceLevel.Warning;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:FaultPropagationRecord.cs


示例16: CreateBookmark

        public Bookmark CreateBookmark(string name, BookmarkCallback callback, ActivityInstance owningInstance, BookmarkOptions options)
        {
            Bookmark toAdd = new Bookmark(name);

            if (this.bookmarks != null && this.bookmarks.ContainsKey(toAdd))
            {
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.BookmarkAlreadyExists(name)));
            }

            AddBookmark(toAdd, callback, owningInstance, options);
            //Regular bookmarks are never important
            UpdateAllExclusiveHandles(toAdd, owningInstance);

            return toAdd;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:BookmarkManager.cs


示例17: BookmarkResumptionRecord

        internal BookmarkResumptionRecord(Guid instanceId, Bookmark bookmark, ActivityInstance ownerInstance, object payload)
            : base(instanceId)
        {
            if (bookmark.Scope != null)
            {
                this.BookmarkScope = bookmark.Scope.Id;
            }

            if (bookmark.IsNamed)
            {
                this.BookmarkName = bookmark.Name;
            }

            this.Owner = new ActivityInfo(ownerInstance);
            this.Payload = payload;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:16,代码来源:BookmarkResumptionRecord.cs


示例18: GenerateWorkItem

        public WorkItem GenerateWorkItem(ActivityInstance completedInstance, ActivityExecutor executor)
        {
            if (this.callbackWrapper != null)
            {
                return this.callbackWrapper.CreateWorkItem(completedInstance, executor);
            }
            else
            {
                // Variable defaults and argument expressions always have a parent
                // and never have a CompletionBookmark
                if (completedInstance.State != ActivityInstanceState.Closed && completedInstance.Parent.HasNotExecuted)
                {
                    completedInstance.Parent.SetInitializationIncomplete();
                }

                return new EmptyWithCancelationCheckWorkItem(completedInstance.Parent, completedInstance);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:18,代码来源:CompletionBookmark.cs


示例19: EnsureActivityInstrumented

        // Lazy instrumentation.
        // Parameter primeCurrentInstance specify whether priming (if needed) is done
        // up to the current instance.  Set this to true when calling this from an "...Completed" 
        // (exit state).
        void EnsureActivityInstrumented(ActivityInstance instance, bool primeCurrentInstance)
        {          
            if (this.debugManager == null)
            {   // Workflow has not been instrumented yet.

                // Finding rootInstance and check all referred sources.
                Stack<ActivityInstance> ancestors = new Stack<ActivityInstance>();
                while (instance.Parent != null)
                {
                    ancestors.Push(instance);
                    instance = instance.Parent;
                }

                Activity rootActivity = instance.Activity;

                // Do breakOnStartup only if debugger is attached from the beginning, i.e. no priming needed.
                // This specified by change the last parameter below to: "(ancestors.Count == 0)".
                this.debugManager = new DebugManager(rootActivity, "Workflow", "Workflow", "DebuggerThread", false, this.host, ancestors.Count == 0);

                if (ancestors.Count > 0)
                {
                    // Priming the background thread 
                    this.debugManager.IsPriming = true;
                    while (ancestors.Count > 0)
                    {
                        ActivityInstance ancestorInstance = ancestors.Pop();
                        this.debugManager.OnEnterState(ancestorInstance);
                    }
                    if (primeCurrentInstance)
                    {
                        this.debugManager.OnEnterState(instance);
                    }
                    this.debugManager.IsPriming = false;
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:40,代码来源:DebugController.cs


示例20: CreateLogicalThread

        // Create logical thread and bring its call stack to reflect call from
        // the root up to (but not including) the instance.
        // If the activity is an expression though, then the call stack will also include the instance
        // (since it is the parent of the expression).
        int CreateLogicalThread(Activity activity, ActivityInstance instance, bool primeCurrentInstance)
        {
            Stack<ActivityInstance> ancestors = null;

            if (!this.DebugStartedAtRoot)
            {
                ancestors = new Stack<ActivityInstance>();

                if (activity != instance.Activity || primeCurrentInstance)
                {   // This mean that activity is an expression and 
                    // instance is the parent of this expression.
                   
                    Fx.Assert(primeCurrentInstance || (activity is ActivityWithResult), "Expect an ActivityWithResult");
                    Fx.Assert(primeCurrentInstance || (activity.Parent == instance.Activity), "Argument Expression is not given correct parent instance");
                    if (primeCurrentInstance || !IsParallelActivity(instance.Activity))
                    {
                        ancestors.Push(instance);
                    }
                }

                ActivityInstance instanceParent = instance.Parent;
                while (instanceParent != null && !IsParallelActivity(instanceParent.Activity))
                {
                    ancestors.Push(instanceParent);
                    instanceParent = instanceParent.Parent;
                }

                if (instanceParent != null && IsParallelActivity(instanceParent.Activity))
                {
                    // Ensure thread is created for the parent (a Parallel activity).
                    int parentThreadId = GetExecutingThreadId(instanceParent.Activity, false);
                    if (parentThreadId < 0)
                    {
                        parentThreadId = CreateLogicalThread(instanceParent.Activity, instanceParent, true);
                        Fx.Assert(parentThreadId > 0, "Parallel main thread can't be created");
                    }
                }
            }

            string threadName = "DebuggerThread:";
            if (activity.Parent != null)
            {
                threadName += activity.Parent.DisplayName;
            }
            else // Special case for the root of WorklowService that does not have a parent.
            {   
                threadName += activity.DisplayName;
            }

            int newThreadId = this.stateManager.CreateLogicalThread(threadName);
            Stack<Activity> newStack = new Stack<Activity>();
            this.runningThreads.Add(newThreadId, newStack);

            if (!this.DebugStartedAtRoot && ancestors != null)
            { // Need to create callstack to current activity.                        
                PrimeCallStack(newThreadId, ancestors);
            }
            
            return newThreadId;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:64,代码来源:DebugManager.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ActivityParameterDictionary类代码示例发布时间:2022-05-24
下一篇:
C# ActivityInfo类代码示例发布时间: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