3
以下是我用来在SilverLight中使用Web服务的代码。Silverlight Web服务
private void button1_Click(object sender, RoutedEventArgs e)
{
BasicHttpBinding bind = new BasicHttpBinding();
EndpointAddress endpoint = new EndpointAddress("http://loalhost/Service.asmx");
ServiceSoapClient client = new ServiceSoapClient(bind, endpoint);
client.RunHelloCompleted += new EventHandler<RunHelloCompletedEventArgs>(client_RunQwinCompleted);
client.RunHelloAsync(command);
}
void client_RunHelloCompleted(object sender, RunHelloCompletedEventArgs e)
{
txtProcess.Text=Process(e.Result);
}
我想知道一种方式,在我运行RunHelloAsync(Command)之后,我想获得返回的结果而不需要完成事件。请建议我。谢谢。
为什么你不能在完成的活动中做你需要的东西? – AnthonyWJones 2010-08-04 12:35:38