Esempio n. 1
0
            public void DoLogin(System.Windows.Forms.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);
                }
            }
Esempio n. 2
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);
                }
            }