Example #1
0
        private async void GLoginBrowser_Navigated(object sender, NavigationEventArgs e)
        {
            ShowProgressBar(true);

            string token = e.Uri.Query;

            if (e.Uri.Query.Contains("xsrf"))
            {
                string source   = GLoginBrowser.SaveToString();
                int    start    = source.IndexOf("<title>") + 20;
                int    end      = source.IndexOf("</title>");
                string authCode = source.Substring(start, end - start);

                bool completed = await GoogleAccount.Authorize(authCode);

                while (!completed)
                {
                    ;
                }

                ShowProgressBar(false);

                NavigationService.Navigate(new Uri("/Views/Birthdays.xaml", UriKind.RelativeOrAbsolute));
            }
        }
Example #2
0
        void GoogleLoginPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (!GoogleAccount.IsConnected)
            {
                ShowProgressBar(true);

                // code to redirect to Google OAuth2 URL
                var oauthUrl = GetOauthUrl();
                GLoginBrowser.Navigate(oauthUrl);
            }
            else
            {
                NavigationService.Navigate(new Uri("/Views/Birthdays.xaml", UriKind.RelativeOrAbsolute));
            }
        }