学WF系列(六)——工作流模拟投票项目
2010-10-01 08:26:22 来源:WEB开发网Form1.cs:
public partial class Form1 : Form
{
private WorkflowRuntime workflowRuntime;
private WorkflowInstance instance;
private AutoResetEvent waitHandle;
private string result = String.Empty;
int count;
public Form1()
{
InitializeComponent();
workflowRuntime = new WorkflowRuntime();
workflowRuntime.StartRuntime();
waitHandle = new AutoResetEvent(false);
workflowRuntime.WorkflowCompleted += delegate(object sender1, WorkflowCompletedEventArgs e1)
{
result = e1.OutputParameters["Result"].ToString();
count = Convert.ToInt32(e1.OutputParameters["CountAll"]);
waitHandle.Set();
};
}
private void button1_Click(object sender, EventArgs e)
{
Dictionary<string, object> dic = new Dictionary<string, object>();
ArrayList list = new ArrayList();
for (int i = 0; i < this.checkedListBox1.CheckedItems.Count;i++ )
{
list.Add(this.checkedListBox1.CheckedItems[i].ToString());
}
dic.Add("ArrayL", list);
instance = workflowRuntime.CreateWorkflow(typeof(Workflow1), dic);
instance.Start();
waitHandle.WaitOne();
MessageBox.Show(result);
MessageBox.Show(count.ToString());
}
}
- ››WF 4.0 beta1中的跟踪机制
- ››WF 4.0的建模风格:顺序和Flowchart
- ››WF4.0 Beta1之旅(5):规则引擎的变化
- ››WF 4.0 beta1活动概览(1):Procedural
- ››WF4.0 Beta1之旅(4):Bookmark的使用
- ››WF4.0 Beta1之旅:基本介绍
- ››WF4.0 Beta1之旅(2):异常处理
- ››WF4.0 Beta1之旅(3):全新的FlowChart
- ››WF 应用场景指南: SharePoint 与工作流(上)
- ››WF 应用场景指南: 展现流(Presentation Flow)
- ››WF单元测试系列1:测试基本的Activity
- ››WF单元测试系列2:简单测试Activity的行为
更多精彩
赞助商链接