zoukankan      html  css  js  c++  java
  • WF4实例对象转化成XAML文档

    示例来自Microsoft Windows Workflow Foundation 4.0 Cookbook P29

    1.  Create a workfow project:
    Create a new Workfow Console Application under the Chapter01 solution and
    name the project ConvertWFInstanceToXML. Delete the Workflow1.xaml fle
    that is created by default.
    2.  Write code to create the workfow and its host:
    Open Program.cs fle and change the code as follows:
    using System;
    using System.Activities;
    using System.Activities.Statements;
    using System.Text;
    using System.Xaml;
    using System.Activities.XamlIntegration;
    using System.IO;
    namespace ConvertWFObjectToXML {
        class Program {
            static void Main(string[] args) {
                //Create a Workflow instance object             
    ActivityBuilder ab = new ActivityBuilder();
                ab.Implementation = new Sequence()
                {
                    Activities =
                    {
                        new WriteLine{Text="Message from Workflow"}
                    }
                };
                //Convert Workflow instance to xml string
                StringBuilder sb = new StringBuilder();
                StringWriter sw = new StringWriter(sb);
                XamlWriter xw =
                    ActivityXamlServices.CreateBuilderWriter(
                    new XamlXmlWriter(sw,
                                      new XamlSchemaContext()));
                XamlServices.Save(xw, ab);
                Console.WriteLine(sb.ToString());
            }
        }
    }
     

  • 相关阅读:
    linux下vim命令详解
    Linux 指令篇:档案目录管理chown
    分级渲染百度地图路段红黄绿功能
    矢量数据的属性值的添加、编辑、删除
    Extjs+C# 文件上传
    IBATIS 的动态SQL语句拼接
    一个DIV位于另一个div的右下角
    ArcGIS JavaScript API 添加点
    将Excel数据导入至SqlServer中
    Extjs 图表控件,可修改X轴与Y轴坐标
  • 原文地址:https://www.cnblogs.com/Rising/p/2679741.html
Copyright © 2011-2022 走看看