经由web服务功能的恢复结果和存储在变量 [英] Recovery result of a function via a webservice and stored in a variable

查看:79
本文介绍了经由web服务功能的恢复结果和存储在变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得这种方法的结果是:布尔认证(字符串日志,串通),这梅索德:字符串作用(字符串日志,串通)来测试authentifcation 这是我做的:

I want to get the result of this method : bool authentication (string log, string pass) and this methode : string role (string log, string pass) to test authentifcation this is what I did :

private void bntValideAuthen_Click(object sender, RoutedEventArgs e)
{ 
    client.AuthentificationCompleted += client_AuthentificationCompleted;
    client.RoleCompleted += client_RoleCompleted;

      ServiceConsum.Service1Client client = new ServiceConsum.Service1Client();
     string rol=client.RoleAsync(txtLogin.text,txtpass.text);
     bool auth = client.AuthentificationAsync(txtLogin.text,txtpass.text);


    if((auth==true)&&(role=="admin"))
    {
      NavigationContext.Equals(new Uri("/Views/admin/starAdmin.xaml", UriKind.Relative));
    }
    else
    {
      message.BOX("error");
    }

    }

它给这个错误: 无法隐式转换类型'无效'到'字符串'

it gives this error : Can not implicitly convert type 'void' to 'string'

推荐答案

解决方案是: 在第二个事件增加胎面这样的:

Solution is : add a tread in second event like :

 void client_RoleCompleted(object sender, RoleCompletedEventArgs e) { 
            role = e.Result.ToString();
            Thread.Sleep(1000);


        }

这篇关于经由web服务功能的恢复结果和存储在变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆