After first scuccessful login & logout windows live sign in button is not working on windows phone

不羁的心 提交于 2019-12-11 01:58:46

问题


Am creating an application which used Windows Phone Live Account & I referred Windows Live Sdk sample code for doing that.

xaml

 <Grid x:Name="LayoutRoot" Background="Transparent">
    <my:SignInButton Name="btnSignin" ClientId="CLIENT_ID" Scopes="wl.signin wl.basic" Branding="Windows" TextType="SignIn" SessionChanged="btnSignin_SessionChanged" HorizontalAlignment="Left"  VerticalAlignment="Top" />       
 </Grid>

Here is the logout code

    public void LogOut()
    {
        var authClient = new LiveAuthClient(ClientId);
        authClient.Logout();
    }

But after my first successful login & logout, i could not login to the live account means Sign In button is not working even it is not disabled at all.
And Every time am getting a LiveConnectSessionStatus.Unknown state on SessionChanged event when i navigated to the login page. What will be the reason for this? Do i need to do anything more in the logout operation? Please confirm.

Thanks


回答1:


Everything you have to do is:

    private LiveConnectClient client;

    private async void btnSignin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e)
    {
        if (e.Status == LiveConnectSessionStatus.Connected)
        {
            client = new LiveConnectClient(e.Session);               
        }
        else
        {
            infoTextBlock.Text = "Not signed in.";
        }
    }

You don't have to program your own Logout - after you signin, the buton changes itself to logout. After SignIn and session changed you have Client - with what you can do what you need.




回答2:


as you in logout you are creating new session with

 public void LogOut()
    {
        var authClient = new LiveAuthClient(ClientId);
        authClient.Logout();
    }

you have to use session from which you logged in

and for that you will get logout automatically in session changed handler



来源:https://stackoverflow.com/questions/20258248/after-first-scuccessful-login-logout-windows-live-sign-in-button-is-not-workin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!