{
private MainPageViewModel _viewModel;
private IMainPageServiceProxy _proxy;
public MainPage() {
InitializeComponent();
_proxy = ServiceFactory.MainPageService;
this._viewModel=new MainPageViewModel(this,_proxy,()=>{this.DataContext = _viewModel;});
}
}
注意该匿名函数函数传给下面这个构造函数
public class MainPageViewModel : INotifyPropertyChanged
{
public MainPageViewModel(IViewBase view, IMainPageServiceProxy proxy, Action callback)
{
this._view = view; this._proxy = proxy; LoadTestReport(callback);
}
又传给下面,这传来传去里面的方法体何时执行,
public void LoadTestReport(Action callback)
{
_view.LoadingBegin();
this._proxy.LoadTestReport( result => {
this.TestReportDatas = result;
_view.LoadingStop();
if (callback != null)
{ callback(); }
});
}
}
又调用以下方法
public void LoadTestReport(Action
- > callback)
{ this.serviceClient.LoadTestReportCompleted +=
new EventHandler
this.serviceClient.LoadTestReportAsync(callback); }
void On_LoadTestReportCompleted(object sender, LoadTestReportCompletedEventArgs e)
{CallbackHandlerByCatch
- >(e, new List
this.serviceClient.LoadTestReportCompleted -= On_LoadTestReportCompleted; }
这个callback变量含义是啥,求教
只是想请教这些匿名函数作为参数,其函数体啥时候执行,搞不清程序执行的流程顺序