使用Silverlight构建插件式应用程序(五)
2008-10-23 11:43:43 来源:WEB开发网具体的实现界面请参照牛人的一篇文章:http://www.cnblogs.com/RChen/archive/2008/07/05/1236046.html
这是服务器端的服务,我们看看客户端的调用:
private void UserRegion(string userName, string userMail, string passWord)
{
WSMain.UserInfo userInfo = new WSMain.UserInfo();
passWord = MD5CryptoServiceProvider.GetMd5String(passWord);
passWord = MD5CryptoServiceProvider.GetMd5String(userName + passWord);
//
userInfo.UserName = userName;
userInfo.PassWord = passWord;
userInfo.EMail = userMail;
//
Uri uri = System.Windows.Browser.HtmlPage.Document.DocumentUri;
string host = uri.AbsoluteUri;
host = host.Substring(0, host.Length - uri.LocalPath.Length);
string servicePath = "/Services/WSMain.svc";
string serviceUri = host + servicePath;
WSMainClient wsMain = new WSMainClient(new System.ServiceModel.BasicHttpBinding(), new System.ServiceModel.EndpointAddress(serviceUri));
wsMain.RegiestCompleted += (o, ev) =>
{
if (ev.Error == null)
{
string result = ev.Result;
if (result == "True")
{
//设定用户信息
PublicUnit.UserInfo.UserName = userName;
PublicUnit.UserInfo.UsereMail = userMail;
PublicUnit.UserInfo.IsLogined = true;
//关闭当前窗口
Close();
}
else
{
this.txtMesage.Text = result;
}
}
};
wsMain.RegiestAsync(userInfo);
}
}
Tags:使用 Silverlight 构建
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接