- //添加引用
- 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;
- }
- }