本文整理汇总了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;
}
示例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);
}
示例3: WorkflowDataContext
internal WorkflowDataContext(ActivityExecutor executor, ActivityInstance activityInstance, bool includeLocalVariables)
{
this.executor = executor;
this.activityInstance = activityInstance;
this.IncludesLocalVariables = includeLocalVariables;
this.properties = CreateProperties();
}
示例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);
}
}
示例5: Initialize
internal void Initialize(HandleInitializationContext context)
{
this.owner = context.OwningActivityInstance;
this.isUninitialized = false;
OnInitialize(context);
}
示例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)));
}
示例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;
}
示例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();
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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();
}
示例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();
}
}
}
示例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);
}
示例15: OnInitialize
protected override void OnInitialize(HandleInitializationContext context)
{
this.owningInstance = context.OwningActivityInstance;
this.executor = context.Executor;
PerformDefaultRegistration();
}