internal void DoLogout(IWin32Window wnd)
            {
                Task <AggregateException> task = AuthClient.IntializeAsync(Scopes).ContinueWith(t =>
                {
                    if (t.Exception != null)
                    {
                        return(t.Exception);
                    }
                    return(null);
                });

                task.Wait();

                //LiveConnectSession session = this.AuthClient.Session;
                //bool isSignedIn = session != null;
                //if (isSignedIn == false)
                {
                    string startUrl = this.AuthClient.GetLogoutUrl();
                    //const string endUrl = "https://login.live.com/oauth20_desktop.srf";
                    this.authForm = new LiveAuthForm(
                        startUrl,
                        null,
                        null);
                    this.authForm.FormClosed += AuthForm_FormClosed;
                    this.authForm.ShowDialog(wnd);
                }
            }
Ejemplo n.º 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Task <AggregateException> task = AuthClient.IntializeAsync(Scopes).ContinueWith(t =>
            {
                if (t.Exception != null)
                {
                    return(t.Exception);
                }
                return(null);
            });

            task.Wait();

            LiveConnectSession session = this.AuthClient.Session;
            bool isSignedIn            = session != null;

            if (isSignedIn == false)
            {
                string startUrl = this.AuthClient.GetLoginUrl(this.Scopes);
                string endUrl   = "https://login.live.com/oauth20_desktop.srf";
                this.authForm = new LiveAuthForm(
                    startUrl,
                    endUrl,
                    this.OnAuthCompleted);
                this.authForm.FormClosed += AuthForm_FormClosed;
                this.authForm.ShowDialog(this);
            }
        }
            public void DoLogin(IWin32Window wnd)
            {
                Task <AggregateException> task = AuthClient.IntializeAsync(Scopes).ContinueWith(t =>
                {
                    if (t.Exception != null)
                    {
                        return(t.Exception);
                    }
                    return(null);
                });

                task.Wait();

                LiveConnectSession session = this.AuthClient.Session;
                bool isSignedIn            = session != null;

                if (isSignedIn == false)
                {
                    string       startUrl = this.AuthClient.GetLoginUrl(this.Scopes);
                    const string endUrl   = "https://login.live.com/oauth20_desktop.srf";
                    this.authForm = new LiveAuthForm(
                        startUrl,
                        endUrl,
                        this.OnAuthCompleted);
                    this.authForm.FormClosed  += AuthForm_FormClosed;
                    this.authForm.NavigatedUrl = OnAuthNavigatedUrl;
                    this.authForm.ShowDialog(wnd);
                }
            }
Ejemplo n.º 4
0
            internal void DoLogout(System.Windows.Forms.IWin32Window wnd)
            {
                Task <AggregateException> task = AuthClient.IntializeAsync(Scopes).ContinueWith(t =>
                {
                    if (t.Exception != null)
                    {
                        return(t.Exception);
                    }
                    return(null);
                });

                task.Wait();

                {
                    string startUrl = this.AuthClient.GetLogoutUrl();
                    //const string endUrl = "https://login.live.com/oauth20_desktop.srf";
                    this.authForm = new LiveAuthForm(
                        startUrl,
                        null,
                        null);
                    this.authForm.FormClosed += AuthForm_FormClosed;
                    this.authForm.ShowDialog(wnd);
                }
            }