本文整理汇总了C#中ActivityInstance类的典型用法代码示例。如果您正苦于以下问题:C# ActivityInstance类的具体用法?C# ActivityInstance怎么用?C# ActivityInstance使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActivityInstance类属于命名空间,在下文中一共展示了ActivityInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
}
}
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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());
}
示例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));
}
示例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;
}
示例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);
}
示例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;
}