经由web服务功能的恢复结果和存储在变量变量、功能、结果、web

由网友(酒壮怂人胆)分享简介:我想获得这种方法的结果是:布尔认证(字符串日志,串通),这梅索德:字符串作用(字符串日志,串通)来测试authentifcation这是我做的:I want to get the result of this method : bool authentication (string log, string pas...

我想获得这种方法的结果是:布尔认证(字符串日志,串通),这梅索德:字符串作用(字符串日志,串通)来测试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);


        }
阅读全文

相关推荐

最新文章