using System; using System.ComponentModel; using System.ComponentModel.Design; using System.Collections; using System.Linq; using System.Workflow.ComponentModel.Compiler; using System.Workflow.ComponentModel.Serialization; using System.Workflow.ComponentModel; using System.Workflow.ComponentModel.Design; using System.Workflow.Runtime; using System.Workflow.Activities; using System.Workflow.Activities.Rules; namespace WorkflowConsoleApplication1 { public sealed partial class Workflow1 : SequentialWorkflowActivity { private int num; private Boolean firstTime = true; public Workflow1() { InitializeComponent(); } private void WhileLoopCondition(object sender, ConditionalEventArgs e) { if (firstTime == true) { e.Result = true; firstTime = false; } else { if (num < 0) { e.Result = true; } else { e.Result = false; } } } private void readNum(object sender, EventArgs e) { Console.WriteLine("Please enter a positive number"); num = Convert.ToInt32(Console.ReadLine()); } private void Zero(object sender, ConditionalEventArgs e) { if (num == 0) { e.Result = true; } else { e.Result = false; } } private void PrintResultForZero(object sender, EventArgs e) { Console.WriteLine("0! is 1"); } private void PrintResult(object sender, EventArgs e) { int fac = 1; for (int i = 1; i < num+1; i++) { fac *= i; } Console.WriteLine(num + "! is " + fac); } } }