本文整理汇总了C#中NativeActivityContext.ResumeBookmark方法的典型用法代码示例。如果您正苦于以下问题:C# NativeActivityContext.ResumeBookmark方法的具体用法?C# NativeActivityContext.ResumeBookmark怎么用?C# NativeActivityContext.ResumeBookmark使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NativeActivityContext
的用法示例。
在下文中一共展示了NativeActivityContext.ResumeBookmark方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NotifyMessage
internal void NotifyMessage(NativeActivityContext context, long compensationId, CompensationBookmarkName compensationBookmark)
{
Bookmark bookmark = this.FindBookmark(compensationId, compensationBookmark);
if (bookmark == null)
{
throw FxTrace.Exception.AsError(new InvalidOperationException(System.Activities.SR.BookmarkNotRegistered(compensationBookmark)));
}
context.ResumeBookmark(bookmark, compensationId);
}
示例2: Execute
protected override void Execute(NativeActivityContext context)
{
Bookmark bookmark = context.CreateBookmark(new BookmarkCallback(this.OnMainRootComplete), BookmarkOptions.NonBlocking);
context.RegisterMainRootCompleteCallback(bookmark);
CompensationExtension extension = context.GetExtension<CompensationExtension>();
extension.WorkflowCompensation = context.CreateBookmark(new BookmarkCallback(this.OnCompensate));
extension.WorkflowConfirmation = context.CreateBookmark(new BookmarkCallback(this.OnConfirm));
context.ResumeBookmark(extension.WorkflowCompensationScheduled, null);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:WorkflowCompensationBehavior.cs
示例3: Execute
protected override void Execute(NativeActivityContext context)
{
Bookmark mainRootCompleteBookmark = context.CreateBookmark(OnMainRootComplete, BookmarkOptions.NonBlocking);
context.RegisterMainRootCompleteCallback(mainRootCompleteBookmark);
CompensationExtension compensationExtension = context.GetExtension<CompensationExtension>();
Fx.Assert(compensationExtension != null, "CompensationExtension must be valid");
compensationExtension.WorkflowCompensation = context.CreateBookmark(new BookmarkCallback(OnCompensate));
compensationExtension.WorkflowConfirmation = context.CreateBookmark(new BookmarkCallback(OnConfirm));
Fx.Assert(compensationExtension.WorkflowCompensationScheduled != null, "compensationExtension.WorkflowCompensationScheduled bookmark must be setup by now");
context.ResumeBookmark(compensationExtension.WorkflowCompensationScheduled, null);
}
示例4: Execute
protected override void Execute(NativeActivityContext context)
{
if (this.Activities.Count > 0)
{
Bookmark bm = context.Properties.Find(Constants._ContainsChildWizard) as Bookmark;
if (bm != null)
{
context.ResumeBookmark(bm, true);
}
Bookmark parentbm = context.Properties.Find(Constants._ResumeParent) as Bookmark;
if (parentbm != null)
{
this.ResumeParent.Set(context, parentbm);
}
Bookmark ResumeParent = context.CreateBookmark(ResumeParentCallBack, BookmarkOptions.NonBlocking | BookmarkOptions.MultipleResume);
context.Properties.Update(Constants._ResumeParent, ResumeParent);
FindStepAndSchedule(context);
}
}
示例5: ResumeParentCallBack
void ResumeParentCallBack(NativeActivityContext context, Bookmark bookmark, object input)
{
int current = this.LastIndex.Get(context);
Command cmd = (Command)input;
current++;
Queue<int> currentposition = new Queue<int>();
if (current >= 0 && current < this.Activities.Count)
{
bool HasBack = (bool)context.Properties.Find(Constants._HasBack);
if (!HasBack && current > 0) context.Properties.Update(Constants._HasBack, true);
bool HasNext = (bool)context.Properties.Find(Constants._HasNext);
if (!HasNext && current < this.activities.Count - 1) context.Properties.Update(Constants._HasNext, true);
currentposition.Enqueue(current);
context.Properties.Update(Constants._CurrentPosition, currentposition);
ScheduleStep(context, current);
}
else
{
Bookmark bm = this.ResumeParent.Get(context);
if (bm != null) context.ResumeBookmark(bm, cmd);
}
}
示例6: FindStepAndSchedule
private void FindStepAndSchedule(NativeActivityContext context)
{
Queue<int> lastposition = (Queue<int>)context.Properties.Find(Constants._LastPosition);
Queue<int> currentposition = (Queue<int>)context.Properties.Find(Constants._CurrentPosition);
Command cmd = (Command)context.Properties.Find(Constants._Command);
int current = lastposition.Count > 0 ? lastposition.Dequeue() : -1;
if (lastposition.Count == 0 && cmd == Command.Next)
{
current++;
}
if (current < 0) current = 0;
if (current >= 0 && current < this.activities.Count)
{
bool HasBack = (bool)context.Properties.Find(Constants._HasBack);
if (!HasBack && current > 0) context.Properties.Update(Constants._HasBack,true);
bool HasNext = (bool)context.Properties.Find(Constants._HasNext);
if (!HasNext && current < this.activities.Count-1) context.Properties.Update(Constants._HasNext, true);
context.Properties.Update(Constants._LastPosition, lastposition);
currentposition.Enqueue(current);
context.Properties.Update(Constants._CurrentPosition, currentposition);
ScheduleStep(context, current);
}
else
{
Bookmark bm = this.ResumeParent.Get(context);
if (bm != null) context.ResumeBookmark(bm, cmd);
}
}
示例7: OnMainRootComplete
void OnMainRootComplete(NativeActivityContext context, Bookmark bookmark, object value)
{
CompensationExtension compensationExtension = context.GetExtension<CompensationExtension>();
Fx.Assert(compensationExtension != null, "CompensationExtension must be valid");
CompensationTokenData rootHandle = compensationExtension.Get(CompensationToken.RootCompensationId);
Fx.Assert(rootHandle != null, "rootToken must be valid");
ActivityInstanceState completionState = (ActivityInstanceState)value;
if (completionState == ActivityInstanceState.Closed)
{
context.ResumeBookmark(compensationExtension.WorkflowConfirmation, new CompensationToken(rootHandle));
}
else if (completionState == ActivityInstanceState.Canceled)
{
context.ResumeBookmark(compensationExtension.WorkflowCompensation, new CompensationToken(rootHandle));
}
else if (completionState == ActivityInstanceState.Faulted)
{
// Do nothing. Neither Compensate nor Confirm.
// Remove the bookmark to complete the WorkflowCompensationBehavior execution.
context.RemoveBookmark(compensationExtension.WorkflowConfirmation);
context.RemoveBookmark(compensationExtension.WorkflowCompensation);
}
}
示例8: OnMainRootComplete
private void OnMainRootComplete(NativeActivityContext context, Bookmark bookmark, object value)
{
CompensationExtension extension = context.GetExtension<CompensationExtension>();
CompensationTokenData tokenData = extension.Get(0L);
switch (((ActivityInstanceState) value))
{
case ActivityInstanceState.Closed:
context.ResumeBookmark(extension.WorkflowConfirmation, new CompensationToken(tokenData));
return;
case ActivityInstanceState.Canceled:
context.ResumeBookmark(extension.WorkflowCompensation, new CompensationToken(tokenData));
return;
case ActivityInstanceState.Faulted:
context.RemoveBookmark(extension.WorkflowConfirmation);
context.RemoveBookmark(extension.WorkflowCompensation);
break;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:WorkflowCompensationBehavior.cs
示例9: Execute
protected override void Execute(NativeActivityContext context)
{
CompensationExtension compensationExtension = context.GetExtension<CompensationExtension>();
Fx.Assert(compensationExtension != null, "CompensationExtension must be valid");
long compensationId = this.compensationId.Get(context);
Fx.Assert(compensationId != CompensationToken.RootCompensationId, "CompensationId passed to the SecondaryRoot must be valid");
CompensationTokenData compensationToken = compensationExtension.Get(compensationId);
Fx.Assert(compensationToken != null, "CompensationTokenData must be valid");
CompensationToken token = new CompensationToken(compensationToken);
this.currentCompensationToken.Set(context, token);
compensationToken.IsTokenValidInSecondaryRoot = true;
context.Properties.Add(CompensationToken.PropertyName, token);
Fx.Assert(compensationToken.BookmarkTable[CompensationBookmarkName.OnConfirmation] == null, "Bookmark should not be already initialized in the bookmark table.");
compensationToken.BookmarkTable[CompensationBookmarkName.OnConfirmation] = context.CreateBookmark(new BookmarkCallback(OnConfirmation));
Fx.Assert(compensationToken.BookmarkTable[CompensationBookmarkName.OnCompensation] == null, "Bookmark should not be already initialized in the bookmark table.");
compensationToken.BookmarkTable[CompensationBookmarkName.OnCompensation] = context.CreateBookmark(new BookmarkCallback(OnCompensation));
Fx.Assert(compensationToken.BookmarkTable[CompensationBookmarkName.OnCancellation] == null, "Bookmark should not be already initialized in the bookmark table.");
compensationToken.BookmarkTable[CompensationBookmarkName.OnCancellation] = context.CreateBookmark(new BookmarkCallback(OnCancellation));
Bookmark onSecondaryRootScheduled = compensationToken.BookmarkTable[CompensationBookmarkName.OnSecondaryRootScheduled];
Fx.Assert(onSecondaryRootScheduled != null, "onSecondaryRootScheduled bookmark must be already registered.");
compensationToken.BookmarkTable[CompensationBookmarkName.OnSecondaryRootScheduled] = null;
context.ResumeBookmark(onSecondaryRootScheduled, compensationId);
}
示例10: OnTriggerCompleted
private void OnTriggerCompleted(NativeActivityContext context, System.Activities.ActivityInstance completedInstance)
{
Pick.PickState state = (Pick.PickState) context.Properties.Find("System.Activities.Statements.Pick.PickState");
if ((completedInstance.State == ActivityInstanceState.Closed) && (state.TriggerCompletionBookmark != null))
{
context.ResumeBookmark(state.TriggerCompletionBookmark, context.ActivityInstanceId);
state.TriggerCompletionBookmark = null;
state.ExecuteActionBookmark = context.CreateBookmark(new BookmarkCallback(this.OnExecuteAction));
}
else if (!context.IsCancellationRequested)
{
context.CreateBookmark();
}
}
示例11: ResumeExecutionActionBookmark
private void ResumeExecutionActionBookmark(PickState pickState, NativeActivityContext context)
{
context.ResumeBookmark(pickState.ExecuteActionBookmark, null);
pickState.ExecuteActionBookmark = null;
}