简体   繁体   中英

Question on workflow Bookmarks

I want to know how can i pass more than one Input Argument in a workflow bookmark. i have this code

   public sealed class CodeActivity1 : NativeActivity<String>
{
    [RequiredArgument]
    public InArgument<string> BookmarkName { get; set; }

    protected override void Execute(NativeActivityContext context)
    {

        context.CreateBookmark(BookmarkName.Get(context),
            new BookmarkCallback(OnResumeBookmark));
    }

    // NativeActivity derived activities that do asynchronous operations by calling 
    // one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext 

    protected override bool CanInduceIdle
    {
        get { return true; }
    }

    public void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark, object obj)
    {
        Result.Set(context, (string)obj);
    }
}

When I resume it like app.ResumeBookmark("Test", "inputTest");. But what if i have for example 2 output Arguments like

        public InArgument<string> BookmarkName { get; set; }
        public OutArgument<string> Test1 {get; set;}
        public OutArgument<string> Test2 {get; set;}

How can i call this bookmark with app.ResumeBookmark()? and set the 2 OutArguments with stirngs from outside?. Like app.ResumeBookmark("Test","Inputtest1","Inputtest2")? Thx for your time

You can pass any object you want into the ResumeBookmark() call. So just create a class with three properties and use an instance of that class.

You can try the following:

    public void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark, object obj)    {        
        Test t = obj as Text;
        context.SetValue(this.Test1, t.S1);    
        context.SetValue(this.Test2, t.S2);    
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM