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);
                }
            }
Beispiel #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);
            }
        }
 private void CleanupAuthForm()
 {
     if (this.authForm != null)
     {
         this.authForm.Dispose();
         this.authForm = null;
     }
 }
Beispiel #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);
                }
            }