zoukankan      html  css  js  c++  java
  • 《WF in 24 Hours》读书笔记

    创建第一个Workflow项目

    1. 创建Workflow项目 – 选择Workflow Console Application

    2. 添加CodeActivity

    3. 打开CodeActivity,添加一行代码到Execute方法中

     1     public sealed class CodeActivity1 : CodeActivity
     2     {
     3         // Define an activity input argument of type string
     4         public InArgument<string> Text { get; set; }
     5 
     6         // If your activity returns a value, derive from CodeActivity<TResult>
     7         // and return the value from the Execute method.
     8         protected override void Execute(CodeActivityContext context)
     9         {
    10             Console.WriteLine("The time is {0}", DateTime.Now.ToLongTimeString());
    11         }
    12     }

    4. 编译,然后打开Workflow1.xaml文件,在工具栏中应该能看到新生成的CodeActivity1。

    5. 依次拖动如下控件到xaml设计器上。Sequence -> CodeActivity1 -> Delay -> CodeActivity1。最终结果如下:

    6. 修改Delay控件属性,将Duration改为10秒。

    7. 修改Program.cs,添加读取字符代码用来暂停程序运行。

     1     class Program
     2     {
     3         static void Main(string[] args)
     4         {
     5             Activity workflow1 = new Workflow1();
     6             WorkflowInvoker.Invoke(workflow1);
     7 
     8             // Pause the display
     9             Console.WriteLine("Press enter to continue.");
    10             Console.Read();
    11         }
    12     }

    8. 运行。结果如下:

     

  • 相关阅读:
    7
    6
    Robot Motion -- 机器人路径规划
    Delaunay Triangulation
    Voronoi Diagram -- 泰森多边形 (维诺图)
    Window query -- 区间线段包含问题
    5
    es6模块化
    js模块化编程之彻底弄懂CommonJS和AMD/CMD!
    混合开发菜鸟级别总结笔记 内容来自百度一下,你就知道
  • 原文地址:https://www.cnblogs.com/ilovewindy/p/3706454.html
Copyright © 2011-2022 走看看