本文整理汇总了C#中NativeActivityContext.CancelChild方法的典型用法代码示例。如果您正苦于以下问题:C# NativeActivityContext.CancelChild方法的具体用法?C# NativeActivityContext.CancelChild怎么用?C# NativeActivityContext.CancelChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NativeActivityContext
的用法示例。
在下文中一共展示了NativeActivityContext.CancelChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTriggerComplete
private void OnTriggerComplete(NativeActivityContext context, Bookmark bookmark, object state)
{
PickState pickState = this.pickStateVariable.Get(context);
string str = (string) state;
ReadOnlyCollection<System.Activities.ActivityInstance> children = context.GetChildren();
bool flag = true;
for (int i = 0; i < children.Count; i++)
{
System.Activities.ActivityInstance activityInstance = children[i];
if (activityInstance.Id != str)
{
context.CancelChild(activityInstance);
flag = false;
}
}
if (flag)
{
this.ResumeExecutionActionBookmark(pickState, context);
}
}
示例2: OnResumeBookmark
private void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark, object value)
{
PSActivity._structuredTracer.Correlate();
if (!this.bookmarking.Get(context))
{
NoPersistHandle noPersistHandle = this.noPersistHandle.Get(context);
noPersistHandle.Exit(context);
}
ActivityOnResumeAction activityOnResumeAction = ActivityOnResumeAction.Resume;
if (value != null && (ActivityOnResumeAction)value.GetType() == typeof(ActivityOnResumeAction))
{
activityOnResumeAction = (ActivityOnResumeAction)value;
}
if (activityOnResumeAction != ActivityOnResumeAction.Restart)
{
PSResumableActivityContext pSResumableActivityContext = null;
if (value != null && value.GetType() == typeof(PSResumableActivityContext))
{
pSResumableActivityContext = (PSResumableActivityContext)value;
}
if (pSResumableActivityContext == null)
{
PSActivityContext item = null;
PSDataCollection<ProgressRecord> progressRecords = null;
try
{
if (this.bookmarking.Get(context))
{
HostParameterDefaults extension = context.GetExtension<HostParameterDefaults>();
if (extension != null && extension != null && extension.AsyncExecutionCollection != null)
{
Dictionary<string, PSActivityContext> asyncExecutionCollection = extension.AsyncExecutionCollection;
if (asyncExecutionCollection != null && asyncExecutionCollection.ContainsKey(context.ActivityInstanceId))
{
item = asyncExecutionCollection[context.ActivityInstanceId];
asyncExecutionCollection.Remove(context.ActivityInstanceId);
}
}
if (item != null)
{
progressRecords = item.progress;
if (base.Result.Expression != null)
{
base.Result.Set(context, item.Output);
}
}
}
else
{
progressRecords = this.PSProgress.Get(context);
item = this.psActivityContextImplementationVariable.Get(context);
this.psActivityContextImplementationVariable.Set(context, null);
HostParameterDefaults hostParameterDefault = context.GetExtension<HostParameterDefaults>();
if (hostParameterDefault != null && hostParameterDefault != null && hostParameterDefault.AsyncExecutionCollection != null)
{
Dictionary<string, PSActivityContext> strs = hostParameterDefault.AsyncExecutionCollection;
if (strs != null && strs.ContainsKey(context.ActivityInstanceId))
{
strs.Remove(context.ActivityInstanceId);
}
}
}
if (item.runningCancelTimer != null)
{
context.CancelChild(item.runningCancelTimer);
}
if (item.exceptions.Count <= 0)
{
this.ActivityEndPersistence(context);
if (!item.Failed)
{
this.WriteProgressRecord(context, progressRecords, Resources.CompletedString, ProgressRecordType.Completed);
}
else
{
this.WriteProgressRecord(context, progressRecords, Resources.FailedString, ProgressRecordType.Completed);
}
}
else
{
this.WriteProgressRecord(context, progressRecords, Resources.FailedString, ProgressRecordType.Completed);
this.Tracer.WriteMessage("PSActivity", "OnResumeBookmark", context.WorkflowInstanceId, "We are about to rethrow the exception in order to preserve the stack trace writing it into the logs.", new string[0]);
this.Tracer.TraceException(item.exceptions[0]);
throw item.exceptions[0];
}
}
finally
{
if (item != null)
{
item.Dispose();
}
}
return;
}
else
{
HostParameterDefaults extension1 = context.GetExtension<HostParameterDefaults>();
if (extension1 != null)
{
//.........这里部分代码省略.........