我目前是新开发的。我正在尝试在我的 Windows 商店项目中连接 Web 服务。
在此代码中没有错误,但它没有响应任何事情。我是想使用另一个代码还是将一些消息框放在来自 Web 服务的调用结果中?
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace Windows8App
{
public sealed partial class Login : Page
{
public Login()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private async void loginAsync(string username, string password)
{
ServiceReference1.Service1SoapClient service = new ServiceReference1.Service1SoapClient();
var response = service.loginwebAsync(username, password);
}
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
string user = txtUsername.Text;
string pass = txtPassword.Text;
System.Threading.Tasks.Task.Run(() =>
{
loginAsync(user, pass);
});
}
}
}