1. There are four templates for workflow applications
2. Hello world : WorkflowConsoleApplication
Basic structure is almost same as C# console mode application
namespace/class/Main
namespace WorkflowConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
WorkflowInvoker.Invoke(new Workflow1());
}
}
}
One more file in the project
Workflow1.xaml
2-1 the graphic form
2-2 tag form
2-3 說明:
主程式進入點,由Workflow1.xaml類別建置物件
WorkflowInvoker.Invoke(new Workflow1());
Workflow1.xaml 類別可用圖形界面,建構活動
3. Workflow1.xaml 可以用C#建置
static Activity wf = new Sequence()
{
Activities = {
new WriteLine()
{
Text = "Before the 1 minute delay."
},
new Delay()
{
Duration = TimeSpan.FromSeconds(20)
},
new WriteLine()
{
Text = "After the 1 minute delay."
}
}
};
static void Main(string[] args)
{
WorkflowInvoker.Invoke(new Workflow1()); // Call WorkFlow1.xaml
try
{
WorkflowInvoker.Invoke(wf, TimeSpan.FromSeconds(60)); // Based on static Activity to create.
}
catch (TimeoutException ex)
{
Console.WriteLine(ex.Message);
}
}
沒有留言:
張貼留言