Exemple #1
0
        private void OnLoginClicked(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FacebookWebBrowser.Visibility = Visibility.Visible;
            StackPanelHeader.Visibility   = Visibility.Collapsed;
            ContentPanel.Visibility       = System.Windows.Visibility.Collapsed;

            var loginUrl = GetFacebookLoginUrl(EndpointHelper.FacebookAppId, ExtendedPermissions);

            FacebookWebBrowser.Navigate(loginUrl);
        }
Exemple #2
0
        private async void FacebookLoginButton_Click(object sender, EventArgs e)
        {
            LoadingPanel.Visible = true;
            await Task.Delay(1500);

            FacebookFirstTime = true;
            // visible fb web browser
            FacebookWebBrowser.Visible = true;
            // suppress script errors
            FacebookWebBrowser.ScriptErrorsSuppressed = true;
            try
            {
                // remove handler
                FacebookWebBrowser.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(FacebookWebBrowserDocumentCompleted);
            }
            catch { }
            // add handler
            FacebookWebBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(FacebookWebBrowserDocumentCompleted);

            // Every time we want to login with another facebook account, we need to clear
            // all cached and cookies for facebook and instagram addresses.
            // WebBrowser control uses Internet Explorer so we need to clean up.
            WebBrowserHelper.ClearForSpecificUrl(FacebookLoginHelper.InstagramUriWithoutWWWAddress.ToString());
            WebBrowserHelper.ClearForSpecificUrl(FacebookLoginHelper.InstagramUriAddress.ToString());
            WebBrowserHelper.ClearForSpecificUrl(FacebookLoginHelper.InstagramApiAddress.ToString());
            WebBrowserHelper.ClearForSpecificUrl(FacebookLoginHelper.FacebookAddress.ToString());
            WebBrowserHelper.ClearForSpecificUrl(FacebookLoginHelper.FacebookMobileAddress.ToString());

            // wait 3.5 second
            System.Threading.Thread.Sleep(3500);
            // navigate to instagram site
            FacebookWebBrowser.Navigate(FacebookLoginHelper.InstagramUriAddress);
            do
            {
                Application.DoEvents();
                System.Threading.Thread.Sleep(1);
            }while (FacebookWebBrowser.ReadyState != WebBrowserReadyState.Complete);
        }
Exemple #3
0
        private async void FacebookLoginButton_Click(object sender, EventArgs e)
        {
            await Task.Delay(1500);

            // visible fb web browser
            FacebookWebBrowser.Visible = true;
            // suppress script errors
            FacebookWebBrowser.ScriptErrorsSuppressed = true;
            try
            {
                // remove handler
                FacebookWebBrowser.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(FacebookWebBrowserDocumentCompleted);
            }
            catch { }
            // add handler
            FacebookWebBrowser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(FacebookWebBrowserDocumentCompleted);

            // Every time we want to login with another facebook account, we need to clear
            // all cached and cookies for facebook addresses.
            // WebBrowser control uses Internet Explorer so we need to clean up.
            WebBrowserHelper.ClearForSpecificUrl(InstaFbHelper.FacebookAddressWithWWWAddress.ToString());
            WebBrowserHelper.ClearForSpecificUrl(InstaFbHelper.FacebookAddress.ToString());
            WebBrowserHelper.ClearForSpecificUrl(InstaFbHelper.FacebookMobileAddress.ToString());

            // wait 3.5 second
            System.Threading.Thread.Sleep(3500);

            var facebookLoginUri = InstaFbHelper.GetFacebookLoginUri();
            var userAgent        = InstaFbHelper.GetFacebookUserAgent();

            FacebookWebBrowser.Navigate(facebookLoginUri, null, null, string.Format("\r\nUser-Agent: {0}\r\n", userAgent));

            do
            {
                Application.DoEvents();
                System.Threading.Thread.Sleep(1);
            }while (FacebookWebBrowser.ReadyState != WebBrowserReadyState.Complete);
        }
Exemple #4
0
        void authHelper_OnLoginCompleted(object sender, EventArgs e)
        {
            Dispatcher.BeginInvoke(() =>
            {
                FacebookWebBrowser.Visibility = Visibility.Collapsed;

                //CHANGE TO TOAST HELPER

                FacebookWebBrowser.Navigated -= FacebookBrowser_Navigated;
                FacebookWebBrowser.Navigate(new Uri("https://www.facebook.com/logout.php?next=https://www.facebook.com/connect/login_success.html&access_token=" + client.AccessToken));

                MessageBox.Show("You successfully sign-in to SpaceTrek", "Great,", MessageBoxButton.OK);

                if (to_page == "create_event")
                {
                    NavigationService.Navigate(new Uri("/View/CreateEventPage.xaml?action=delete", UriKind.Relative));
                }
                else if (to_page == "record_event")
                {
                    NavigationService.Navigate(new Uri("/View/Camera.xaml?action=delete", UriKind.Relative));
                }
            });
        }
Exemple #5
0
        private void FacebookBrowser_Loaded(object sender, RoutedEventArgs e)
        {
            var loginUrl = GetFacebookLoginUrl(EndpointHelper.FacebookAppId, ExtendedPermissions);

            FacebookWebBrowser.Navigate(loginUrl);
        }
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            var loginUrl = FacebookService.GenerateLoginUrl(Vars.FacebookAppId, Vars.Permissions);

            FacebookWebBrowser.Navigate(loginUrl);
        }