예제 #1
0
        private async void webBrowser2_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            if (e.Url.AbsoluteUri == LoginUrl)
            {
                return;
            }
            if ((e.Url.AbsoluteUri.Contains("/Identity/Account/Logout")))
            {
                //maybe we are logged in now
                GetCookieContainer();
            }
            else if (e.Url.AbsoluteUri.Contains("/Identity/Account/Manage"))
            {
                //we are logged in!
                GetCookieContainer();
                var user = await StaticUtils.Client.GetUserByAuthorizationWithHttpMessagesAsync();

                SINnersOptions.AddVisibilityForEmail(user.Body.Email);
                this.Close();
            }
        }
예제 #2
0
        private async void webBrowser2_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            if (e.Url.AbsoluteUri == LoginUrl)
            {
                return;
            }
            if ((e.Url.AbsoluteUri.Contains("/Identity/Account/Logout")))
            {
                //maybe we are logged in now
                GetCookieContainer();
            }
            else if (e.Url.AbsoluteUri.Contains("/Identity/Account/Manage"))
            {
                try
                {
                    //we are logged in!
                    GetCookieContainer();
                    var client = await StaticUtils.GetClient();

                    var user = await client.GetUserByAuthorizationWithHttpMessagesAsync();

                    if (user.Body != null)
                    {
                        login = true;
                        SINnersOptions.AddVisibilityForEmail(user.Body.Email);
                        this.Close();
                    }
                    else
                    {
                        login = false;
                    }
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                    throw;
                }
            }
        }