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