本文主要是介绍在WP7中WebServices的应用方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
- //添加引用
- using DecoMailer.ServiceReference1;
- //在[按钮]押下事件中
- private void KanjiModeButton_Click(object sender, RoutedEventArgs e)
- {
- //实例化SoapClient
- ServiceReference1.Service1SoapClient soap = new Service1SoapClient();
- //调用GetMessage方法,并把ID:1传给方法
- soap.GetMessageAsync("1");
- //Respones将触发GetMessageCompletedEvent事件,并调用soap_GetMessage处理
- soap.GetMessageCompleted += new EventHandler<GetMessageCompletedEventArgs>(soap_GetMessage);
- }
- private void soap_GetMessage(object sender, GetMessageCompletedEventArgs e)
- {
- if (e.Error == null)
- {
- //取得最新的Message类对象
- ServiceReference1.Message lastMessage = e.Result;
- //MessageEditor.Message = lastMessage;
- }
- }
这篇关于在WP7中WebServices的应用方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!