我的第一个工作流  \"Hello Word\"
新建状态机工作流项目\"WorkflowLibrary1\"
  private void codeActivity1_ExecuteCode(object sender, EventArgs e)
        {
           // System.Windows.Forms.MessageBox.Show(\"sdlkalksadfasdF\");
            CodeActivity cd = new CodeActivity();
            Console.WriteLine(\"Hello, from \'{0}\'.\\nI\'m an instance of the {1} class.\",cd.Name, cd.ToString());


        }
2、添加新项目(控制台程序)\"ConsoleApplication1\"代码如下:
 class Program
    {
        static AutoResetEvent waitHandle = new AutoResetEvent(false);
        static void Main(string[] args)
        {
            //Form1 fr = new Form1();
            //fr.Show();
            WorkflowRuntime wn = new WorkflowRuntime();
            wn.StartRuntime();

            wn.WorkflowCompleted +=new EventHandler<WorkflowCompletedEventArgs>(OnWorkflowCompleted);
            Type type = typeof(WorkflowLibrary1.Workflow1);
            WorkflowInstance inst = wn.CreateWorkflow(type);
            inst.Start();
            //wn.CreateWorkflow(type);
           
            waitHandle.WaitOne();
           
            wn.StopRuntime();
            Console.WriteLine(\"\");
            Console.WriteLine(\"\");
            Console.WriteLine(\"==========================\");
            Console.WriteLine(\"Press any key to exit.\");
            Console.WriteLine(\"==========================\");
            Console.ReadLine();
        }

        static void OnWorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
        {
            waitHandle.Set();
            //throw new Exception(\"The method Or operation is not implemented.\");
        }
    }
实现结果
[img=http://www.microsoft.com/china/MSDN/library/Windev/WindowsVista/art/wwfgetstart_04.png]

相关文章:

  • 2022-02-08
  • 2021-11-04
  • 2021-06-11
  • 2022-12-23
  • 2021-10-29
  • 2021-12-07
猜你喜欢
  • 2021-09-02
  • 2021-07-17
  • 2021-04-05
  • 2022-12-23
  • 2022-03-07
  • 2021-12-10
相关资源
相似解决方案