Creating an Input Message activity using Bookmark
When a workflow is running and we want to send a message to the workflow during run time, how can we achieve this? We can use Bookmark to achieve this. In this task, we will create an activity using Bookmark, which will function as a message input activity.
How to do it...
Create the InputMessage activity:
Add a new code file to the
ActivityLibrary
project namedInputMessage.cs
. Then, replace all the default code with the following code:using System.Activities; public class InputMessage<T>:NativeActivity { public InArgument<string> bookmarkName { get; set; } public OutArgument<T> result { get; set; } protected override void Execute(NativeActivityContext context){ context.CreateBookmark(bookmarkName.Get(context), new BookmarkCallback(OnResumeBookmark)); } public void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark...