博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
从加载的XML文档重建工作流
阅读量:7124 次
发布时间:2019-06-28

本文共 1260 字,大约阅读时间需要 4 分钟。

示例来自microsoft windows workflow foundation 4.0 cookbook P31

 

1.  Create a workfow project:
Create a new Workfow Console Application under the Chapter01 solution and
name the project as LoadUpWorkflowFromXML.
2.  Author a workfow:
Author the Workflow1.xaml fle; this workfow will print a string to console as shown
in the following screenshot:
3.  Create code to load up the workfow instance from an XAML string:
Open Program.cs fle and change code as follow:
using System;
using System.Activities;
using System.Activities.Statements;
using System.IO;
using System.Collections;
using System.Text;
using System.Activities.XamlIntegration;
namespace LoadUpWorkflowFromXML {
    class Program {
        static void Main(string[] args) {
            string filePath=           @"C:\WF4Cookbook\Chapter01\
LoadUpWFFromXML\Workflow1.xaml";
            string tempString="";
            StringBuilder xamlWFString = new StringBuilder();
            StreamReader xamlStreamReader =
                new StreamReader(filePath);
            while (tempString != null){
                tempString = xamlStreamReader.ReadLine();
                if (tempString != null) {
                    xamlWFString.Append(tempString);
                }
            }
            Activity wfInstance = ActivityXamlServices.Load(
                new StringReader(xamlWFString.ToString()));
            WorkflowInvoker.Invoke(wfInstance);
        }
    }
}
 

转载于:https://www.cnblogs.com/Rising/archive/2012/09/11/2679744.html

你可能感兴趣的文章
js实现在input框中动态添加图标
查看>>
element-ui配合vue分页
查看>>
控制语句执行流程
查看>>
解决Error: NJS-045错误 ubuntu环境配置Nodejs访问Oracle
查看>>
利用Nginx反向代理解决跨域问题
查看>>
一个图片偶尔加载不出来的事故
查看>>
vue.js起步
查看>>
TableStore实战:DLA+SQL实时分析TableStore
查看>>
【跃迁之路】【613天】程序员高效学习方法论探索系列(实验阶段370-2018.10.17)...
查看>>
Python:Tornado 第三章:HTML5 WebSocket概念及应用:第三节:客户端编程
查看>>
你用过不写代码就能完成一个简单模块的组件么?
查看>>
LeetCode 622——设计循环队列
查看>>
轻量级富文本编辑器wangEditor结合vue使用方法
查看>>
高程3总结#第10章DOM
查看>>
记一次Win10安装MySQL Server 5.7.20失败
查看>>
javascript对象原型成员详解
查看>>
vue进阶1-1 - 项目搭建(vue-cli)
查看>>
R语言与Tableau集成之可视化应用
查看>>
原来PHP对象比数组用更少的内存
查看>>
虎牙数万主播同时在线直播的秘密,CDN推流日志上行实时监控
查看>>