【问题标题】:Execute several methods [closed]执行几种方法[关闭]
【发布时间】:2013-02-04 02:43:42
【问题描述】:

如何执行几个方法,但每个方法都要等到前一个加载网页? 例子:

methode1(){
webBrowser1.Navigate("http://test.com");
}
methode2(){
webBrowser1.Navigate("http://test2.com");
}

methode1();
methode2();

【问题讨论】:

标签: c# html visual-studio-2010 browser


【解决方案1】:

运行异步另一个方法,同步执行多个方法

methode1(){
   webBrowser1.Navigate("http://test.com");
}
methode2(){
   webBrowser1.Navigate("http://test2.com");
}

public void BatchRun()
{
   methode1(); // run sync
   methode2(); // run sync after Method1
}

// ...

Action toRun = BatchRun;
toRun.BeginInvoke(null, null); // Run async

【讨论】:

  • 它们还在一个接一个地运行。
猜你喜欢
  • 2023-04-05
  • 1970-01-01
  • 2014-09-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多