WEB开发网
开发学院软件开发C语言 学WF系列(七)——改善登录程序(上) 阅读

学WF系列(七)——改善登录程序(上)

 2010-10-01 08:25:43 来源:WEB开发网   
核心提示: Workflow1.cs:publicsealedpartialclassWorkflow1:SequentialWorkflowActivity{publicWorkflow1(){InitializeComponent();}privatevoidhandleExternalEventAct

Workflow1.cs:

public sealed partial class Workflow1 : SequentialWorkflowActivity
{
  public Workflow1()
  {
    InitializeComponent();
  }

  private void handleExternalEventActivity1_Invoked(object sender, ExternalDataEventArgs e)
  {
    MessageBox.Show("Success");
  }
}

Winform1.cs:

public partial class Form1 : Form,IEvent
{
  private WorkflowRuntime runtime;
  private ExternalDataExchangeService service;
  private WorkflowInstance instance;
  public Form1()
  {
    InitializeComponent();
    runtime = new WorkflowRuntime();
    service = new ExternalDataExchangeService();
    runtime.AddService(service);
    service.AddService(this);
    runtime.StartRuntime();
  }
  private void button1_Click(object sender, EventArgs e)
  {
    instance = runtime.CreateWorkflow(typeof(WorkflowConsoleApplication7.Workflow1));
    instance.Start();
    ExternalDataEventArgs args = new ExternalDataEventArgs(instance.InstanceId);
    MyEvent1(null, args);
  }


  #region IEvent 成员

  public event EventHandler<ExternalDataEventArgs> MyEvent1;

  #endregion
}

上一页  1 2 3 4 5  下一页

Tags:WF 系列 改善

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