WEB开发网
开发学院软件开发C语言 学WF系列(六)——工作流模拟投票项目 阅读

学WF系列(六)——工作流模拟投票项目

 2010-10-01 08:26:22 来源:WEB开发网   
核心提示: privatevoidActivity_Initialized(objectsender,EventArgse){this.replicatorActivity1.InitialChildData=array;}然后我们要在每一次遍历之前知道我们这次遍历的是什么实体:privatevoidAct

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"); //实际中不应有
  }
}

上一页  1 2 3 4 5  下一页

Tags:WF 系列 工作流

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接