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


C# Activities.ActivityInstance类代码示例

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


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

示例1: FaultWorkItem

 public FaultWorkItem(FaultCallbackWrapper callbackWrapper, Exception propagatedException, System.Activities.ActivityInstance propagatedFrom, ActivityInstanceReference originalExceptionSource) : base(callbackWrapper.ActivityInstance)
 {
     this.callbackWrapper = callbackWrapper;
     this.propagatedException = propagatedException;
     this.propagatedFrom = propagatedFrom;
     this.originalExceptionSource = originalExceptionSource;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:FaultCallbackWrapper.cs

示例2: OnExecuteBodyCompleted

        private void OnExecuteBodyCompleted(NativeActivityContext context, ActivityInstance instance)
        {
            var vars = ComputationContext.GetVariables(context, this);
            vars.Set(IterationNoVarName, vars.Get<int>(IterationNoVarName) + 1);

            context.ScheduleActivity(Condition, OnExecuteConditionCompleted);
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:7,代码来源:TrainingLoop.cs

示例3: WorkflowDataContext

 internal WorkflowDataContext(ActivityExecutor executor, ActivityInstance activityInstance, bool includeLocalVariables)
 {
     this.executor = executor;
     this.activityInstance = activityInstance;
     this.IncludesLocalVariables = includeLocalVariables;
     this.properties = CreateProperties();
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:WorkflowDataContext.cs

示例4: InternalExecute

        void InternalExecute(NativeActivityContext context, ActivityInstance completedInstance)
        {
            CompensationExtension compensationExtension = context.GetExtension<CompensationExtension>();
            if (compensationExtension == null)
            {
                throw SA.FxTrace.Exception.AsError(new InvalidOperationException(SA.SR.CompensateWithoutCompensableActivity(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.onChildCompensated == null)
                {
                    this.onChildCompensated = new CompletionCallback(InternalExecute);
                }

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

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

示例5: Initialize

        internal void Initialize(HandleInitializationContext context)
        {
            this.owner = context.OwningActivityInstance;
            this.isUninitialized = false;

            OnInitialize(context);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:Handle.cs

示例6: OnPickupCompleted

        void OnPickupCompleted(NativeActivityContext context, ActivityInstance completedInstance)
        {
            if (completedInstance.State != ActivityInstanceState.Executing)
                return;

            if (!GetElement(context).HasElements)
                GetElement(context).Add(new XElement("Pause",
                    new XAttribute("length", 0)));
        }
开发者ID:wasabii,项目名称:twilio-net,代码行数:9,代码来源:DialQueue.cs

示例7: NativeActivityFaultContext

        internal NativeActivityFaultContext(ActivityInstance executingActivityInstance,
            ActivityExecutor executor, BookmarkManager bookmarkManager, Exception exception, ActivityInstanceReference source)
            : base(executingActivityInstance, executor, bookmarkManager)
        {
            Fx.Assert(exception != null, "There must be an exception.");
            Fx.Assert(source != null, "There must be a source.");

            this.exception = exception;
            this.source = source;
        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:10,代码来源:NativeActivityFaultContext.cs

示例8: BodyFaultCallback

 // TODO: we propagate an unhandled exception during an operation back to the task, should we handle it differently?
 private void BodyFaultCallback(NativeActivityFaultContext context, Exception propagatedException, ActivityInstance propagatedFrom)
 {
     if (!context.GetReceiveRequestSendResponseScopeExecutionProperty().TrySetTaskCompletionSourceException(propagatedException))
         // this will add a WorkflowInstanceAbortedRecord with the reason
         context.Abort(propagatedException);
     else
         // this won't add any WorkflowInstanceAbortedRecord at all
         context.Abort();
     context.HandleFault();
 }
开发者ID:helmsb,项目名称:Orleans.Activities,代码行数:11,代码来源:ReceiveRequestSendResponseScope.cs

示例9: OnWorkflowResumed

 // Called when the workflow is resumed after the activity is invoked, and the
 // workflow is resumed.
 public void OnWorkflowResumed(NativeActivityContext context, ActivityInstance instance)
 {
     // Check if the log file is still there. If it is, re-run this activity.
     // Otherwise, we're done.
     string logPath = LogPath.Get(context);
     if (System.IO.File.Exists(logPath))
     {
         Execute(context);
     }
 }
开发者ID:dhanzhang,项目名称:Windows-classic-samples,代码行数:12,代码来源:ContainerActivity.cs

示例10: OnEvaluateConditionCompleted

 void OnEvaluateConditionCompleted(NativeActivityContext context, ActivityInstance instance, bool result)
 {
     if (result)
     {
         if (this.Body != null)
         {
             //if the Condition evaluates to true and the Body is not null
             //schedule the Body with the InternalExecute as the CompletionCallback
             context.ScheduleActivity(this.Body, InternalExecute);
         }
     }
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:12,代码来源:MyWhile.cs

示例11: InternalExecute

 sealed internal override void InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
 {
     CodeActivityContext context = executor.CodeActivityContextPool.Acquire();
     try
     {
         context.Initialize(instance, executor);
         Execute(context);
     }
     finally
     {
         context.Dispose();
         executor.CodeActivityContextPool.Release(context);
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:CodeActivity.cs

示例12: OnGetNextVectorsCompleted

        private void OnGetNextVectorsCompleted(NativeActivityContext context, ActivityInstance instance, NeuralVectors vectors)
        {
            var list = vectorList.Get(context);

            if (vectors != null) list.Add(vectors);

            if (vectors == null || list.Count == GetBatchSize(context))
            {
                GetNextVectorsDone(context, list.ToArray(), TrainingResetSchedule.None);
            }
            else if (vectors.IsEndOfStream)
            {
                GetNextVectorsDone(context, list.ToArray(), TrainingResetSchedule.AfterExecution);
            }
            else
            {
                ScheduleGetNextVectors(context);
            }

            list.Clear();
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:21,代码来源:StreamBatcher.cs

示例13: InternalExecute

        sealed internal override void InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
        {
            // first set up an async context
            AsyncOperationContext asyncContext = executor.SetupAsyncOperationBlock(instance);
            instance.IncrementBusyCount();

            AsyncCodeActivityContext context = new AsyncCodeActivityContext(asyncContext, instance, executor);
            bool success = false;
            try
            {
                IAsyncResult result = BeginExecute(context, AsyncCodeActivity.OnExecuteComplete, asyncContext);

                if (result == null)
                {
                    throw FxTrace.Exception.AsError(new InvalidOperationException(SR.BeginExecuteMustNotReturnANullAsyncResult));
                }

                if (!object.ReferenceEquals(result.AsyncState, asyncContext))
                {
                    throw FxTrace.Exception.AsError(new InvalidOperationException(SR.BeginExecuteMustUseProvidedStateAsAsyncResultState));
                }

                if (result.CompletedSynchronously)
                {
                    EndExecute(context, result);
                    asyncContext.CompleteOperation();
                }
                success = true;
            }
            finally
            {
                context.Dispose();
                if (!success)
                {
                    asyncContext.CancelOperation();
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:38,代码来源:AsyncCodeActivity.cs

示例14: InternalExecute

        void InternalExecute(NativeActivityContext context, ActivityInstance instance)
        {
            //grab the index of the current Activity
            int currentActivityIndex = this.currentIndex.Get(context);
            if (currentActivityIndex == Activities.Count)
            {
                //if the currentActivityIndex is equal to the count of MySequence's Activities
                //MySequence is complete
                return;
            }

            if (this.onChildComplete == null)
            {
                //on completion of the current child, have the runtime call back on this method
                this.onChildComplete = new CompletionCallback(InternalExecute);
            }

            //grab the next Activity in MySequence.Activities and schedule it
            Activity nextChild = Activities[currentActivityIndex];
            context.ScheduleActivity(nextChild, this.onChildComplete);

            //increment the currentIndex
            this.currentIndex.Set(context, ++currentActivityIndex);
        }
开发者ID:blacklensama,项目名称:1709,代码行数:24,代码来源:ParallelActivity.cs

示例15: OnInitialize

 protected override void OnInitialize(HandleInitializationContext context)
 {
     this.owningInstance = context.OwningActivityInstance;
     this.executor = context.Executor;
     PerformDefaultRegistration();
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:6,代码来源:ExclusiveHandle.cs


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