public void queryViews() { ServiceCodeGenerator.ServiceCodeGeneratorClient client = new ServiceCodeGenerator.ServiceCodeGeneratorClient(); client.queryViewsCompleted += (sender, e) => { ServicesEventArgs <ServiceCodeGenerator.table[]> arg = new ServicesEventArgs <ServiceCodeGenerator.table[]>(); if (e.Error == null) { arg.Result = e.Result; arg.Succesed = true; } else { arg.Succesed = false; arg.Error = e.Error; #if DEBUG arg.Succesed = true; arg.Result = null; #endif //写错误日志 //..... } if (queryViewsCompleted != null) { queryViewsCompleted.Invoke(this, arg); } }; client.queryViewsAsync(); }