How to use bookmark in WF4
BookMark can be used to implement event driven style workflow. Below is some sample code.
//in your activity, you override Execute method, to put your workflow idle
protected override void Execute(NativeActivityContext context)
{
string bookmark = this.BookmarkName.Get(context);
context.CreateBookmark(bookmark,
delegate(NativeActivityContext ctx, Bookmark bMark, object state)
{
string input = state as string;
ctx.SetValue(this.Result, input);
});
}
//in your host, wakeup your workflow
application.ResumeBookmark(bookmarkName, text);