简体   繁体   中英

Setting the argument's value in workflow c#

I am using Windows Workflow Foundation .NET 4.5.2. I have an issue regarding setting an argument of type bool (could be also a variable) in designer from inside CodeActivity.

In the designer, I set the argument newProject of type bool with direction In . (should it have another direction? ie InOut ).

In code I want to set the argument from designer to value true .

 public class Inquire : CodeActivity
 {
    public InArgument<bool> newProject { get; set; }

    public InArgument<bool> rework { get; set; }

    protected override void Execute(CodeActivityContext context)
    {
         Console.WriteLine("For a new project type 'new', for rework type 'rw'.");
         string inquire = Console.ReadLine();

         if (inquire == "new")
         {
             context.SetValue(newProject, true);
         }
         else
         {
             rework.Set(context, true);
         }
     }
 }

The argument in the designer is verified in a transition that enables me to get to the next state. If it is true , I can get to the next state. The problem is that the argument in the designer does not receive the new value that is set in the code above. How can it be done?

如果要将值传递回设计器,则需要将其设为Out参数或InOut参数。

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