2 By default a Workflow1.xaml file is generated in the project.
3. Drag and drop a Flowchart, a Flowdecision, an Assign to the designer.
4. Add variables and argument in workflow environment, make it look something like this.
5. Edit Program.cs.
using System; using System.Activities; using System.Collections.Generic; namespace WorkflowConsoleApplication1 { class Program { static void Main(string[] args) { // Prepare argument name:value pair Dictionary<string,object>, // where string is the variable name // and object is the value of the variable var inArg = (IDictionary<string, object>)new Dictionary<string, object>(); inArg.Add("Gender","Female"); // Initialize the workflow. Activity workflow1 = new Workflow1(); // Invoke it by passing the argument name:value pair // and get the result in the same way. // Extract the result by specifying the name of the variable. Console.WriteLine(WorkflowInvoker.Invoke(workflow1, inArg)["Result"]); Console.ReadLine(); } } }
6. Very ugly but simple enough and done.
One more thing, you can edit the Workflow1.xaml file in code by right-click the file and select view code.
0 件のコメント:
コメントを投稿