简体   繁体   English

有关工作流书签的问题

[英]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");. 当我像app.ResumeBookmark(“ Test”,“ inputTest”);一样恢复它时。 But what if i have for example 2 output Arguments like 但是如果我有例如2个输出参数怎么办

        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()? 如何使用app.ResumeBookmark()调用此书签? and set the 2 OutArguments with stirngs from outside?. 并设置2个OutArguments与来自外部的stngng? Like app.ResumeBookmark("Test","Inputtest1","Inputtest2")? 像app.ResumeBookmark(“ Test”,“ Inputtest1”,“ Inputtest2”)一样? Thx for your time 谢谢你的时间

You can pass any object you want into the ResumeBookmark() call. 您可以将任何想要的对象传递给ResumeBookmark()调用。 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);    
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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