簡體   English   中英

在工作流C#中設置參數的值

[英]Setting the argument's value in workflow c#

我正在使用Windows Workflow Foundation .NET 4.5.2。 我從CodeActivity內部在設計器中設置bool類型的參數(也可能是變量)時遇到問題。

在設計器中,我設置了方向為In bool類型的newProject參數。 (它應該有另一個方向嗎?即InOut )。

在代碼中,我想將設計器的參數設置為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);
         }
     }
 }

設計器中的參數在過渡過程中得到了驗證,這使我能夠進入下一個狀態。 如果是true ,我可以進入下一個狀態。 問題在於設計器中的參數不會收到在上面的代碼中設置的新值。 如何做呢?

如果要將值傳遞回設計器,則需要將其設為Out參數或InOut參數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM