如何在不使用service_GetItemInfoCompleted()
以下代码中的函数的情况下调用 Web 服务?没有函数能不能得到结果service_GetItemInfoCompleted()
。
任何的想法?
private void btnFind_Click(object sender, RoutedEventArgs e)
{
Service1Client service = new Service1Client();
service.GetItemInfoAsync(txt1.Text);
service.GetItemInfoCompleted += new EventHandler<GetItemInfoCompletedEventArgs>(service_GetItemInfoCompleted);
}
void service_GetItemInfoCompleted(object sender, GetItemInfoCompletedEventArgs e)
{
txb1.Text = e.Result;
}
示例 2
public void running()
{
ServiceReference1.WebServiceSoapClient test = new ServiceReference1.WebServiceSoapClient();
test.ReadTotalOutstandingInvoiceCompleted += new EventHandler<ServiceReference1.ReadTotalOutstandingInvoiceCompletedEventArgs>(serviceClient);
test.ReadTotalOutstandingInvoiceAsync();
}
public void serviceClient(object sender, ReadTotalOutstandingInvoiceCompletedEventArgs e)
{
answer = int.parse(e.Result.ToString());
}