学WF系列(六)——工作流模拟投票项目
2010-10-01 08:26:22 来源:WEB开发网private void Activity_Initialized(object sender, EventArgs e)
{
this.replicatorActivity1.InitialChildData = array;
}
然后我们要在每一次遍历之前知道我们这次遍历的是什么实体:
private void Activity_ChildInitialized(object sender, ReplicatorChildEventArgs e)
{
vote = e.InstanceData as String;
}
剩下的工作就很简单了,让我们看一看整个项目的代码:
Workflow.cs:
public sealed partial class Workflow1 : SequentialWorkflowActivity
{
private string vote;
private int countAll = 0;
private string result = String.Empty;
private ArrayList array;
public ArrayList ArrayL
{
set { array = value; }
}
public string Result
{
get { return result; }
}
public int CountAll
{
get { return countAll; }
}
public Workflow1()
{
InitializeComponent();
}
private void Activity_Initialized(object sender, EventArgs e)
{
this.replicatorActivity1.InitialChildData = array;
}
private void codeActivity1_ExecuteCode(object sender, EventArgs e)
{
countAll++;
}
private void Activity_ChildInitialized(object sender, ReplicatorChildEventArgs e)
{
vote = e.InstanceData as String;
vote = "您给" + vote + "投了票";
}
private void Activity_ChildCompleted(object sender, ReplicatorChildEventArgs e)
{
result = result + "n" + vote;
MessageBox.Show("Complete"); //实际中不应有
}
private void Activity_Completed(object sender, EventArgs e)
{
MessageBox.Show("All Complete"); //实际中不应有
}
}
- ››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的行为
赞助商链接