Example #1
0
        /// <summary>
        /// Permet à l'utilisateur de se déconnecter de Facebook
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void DeconnexionFacebookBoutonTap(object sender, RoutedEventArgs e)
        {
            App.EstAuthentifie = false;

            var facebookWebBrowser = new WebBrowser();

            facebookWebBrowser.Navigate(new Uri(String.Format("https://www.facebook.com/logout.php?next={0}&access_token={1}", "http://www.facebook.com", App.AccessToken)));
            await facebookWebBrowser.ClearCookiesAsync();

            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            const string key = "UtilisateurConnecte";

            if (!settings.Contains(key))
            {
                settings.Add(key, false);
            }
            else
            {
                settings[key] = false;
            }


            settings.Save();

            FacebookConnexion();

            AffichageRangScore();
        }
        /// <summary>
        /// This method is called when navigated to the page.
        /// </summary>
        /// <param name="e"></param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (SignInBrowser != null)
            {
                await SignInBrowser.ClearCookiesAsync();

                await SignInBrowser.ClearInternetCacheAsync();

                SignInBrowser.Navigating -= SignIn_Navigating;
                placeHolder.Child         = null;
            }

            SignInBrowser = new WebBrowser();
            SignInBrowser.IsScriptEnabled     = true;
            SignInBrowser.Navigating         += SignIn_Navigating;
            SignInBrowser.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;
            SignInBrowser.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            placeHolder.Child = SignInBrowser;
            if (!AppSettings.TestMode && string.IsNullOrWhiteSpace(AppSettings.SecurityToken))
            {
                SignInBrowser.Navigate(AppSettings.AuthenticationUri);
            }
            else
            {
                NavigateToNextPage();
            }
        }
 public void show(float x, float y)
 {
     AppObject.OnOrientationChange += AppObject_OnOrientationChange;
     _popup.IsOpen = true;
     try {
         _browser.ClearCookiesAsync();
         var requestTokenQuery = OAuthUtil.GetRequestTokenQuery();
         requestTokenQuery.RequestAsync(AppSettings.RequestTokenUri, null);
         requestTokenQuery.QueryResponse += new EventHandler <WebQueryResponseEventArgs>(requestTokenQuery_QueryResponse);
     } catch (Exception ex) {
         fail();
     }
 }
Example #4
0
        public static void ClearCookies()
        {
#if SILVERLIGHT
            var webBrowser = new WebBrowser();

            webBrowser.ClearCookiesAsync();
#else
            Windows.Web.Http.Filters.HttpBaseProtocolFilter myFilter = new Windows.Web.Http.Filters.HttpBaseProtocolFilter();
            var cookieManager = myFilter.CookieManager;
            HttpCookieCollection myCookieJar = cookieManager.GetCookies(new Uri("https://vk.com"));
            foreach (HttpCookie cookie in myCookieJar)
            {
                cookieManager.DeleteCookie(cookie);
            }

            myCookieJar = cookieManager.GetCookies(new Uri("https://login.vk.com"));
            foreach (HttpCookie cookie in myCookieJar)
            {
                cookieManager.DeleteCookie(cookie);
            }
#endif
        }
Example #5
0
        public static void ClearCookies()
        {
#if SILVERLIGHT

            var webBrowser = new WebBrowser();

            webBrowser.ClearCookiesAsync();

#else

            Windows.Web.Http.Filters.HttpBaseProtocolFilter myFilter = new Windows.Web.Http.Filters.HttpBaseProtocolFilter();
            var cookieManager = myFilter.CookieManager;
            HttpCookieCollection myCookieJar = cookieManager.GetCookies(new Uri("https://vk.com"));
            foreach (HttpCookie cookie in myCookieJar)
            {
                cookieManager.DeleteCookie(cookie);
            }

            myCookieJar = cookieManager.GetCookies(new Uri("https://login.vk.com"));
            foreach (HttpCookie cookie in myCookieJar)
            {
                cookieManager.DeleteCookie(cookie);
            }
#endif
        }
Example #6
0
        public bool csWork(String action, String actionData)
        {
            if (action == "CCWebView::openPage")
            {
                if (m_webView == null)
                {
                    m_webView = new WebBrowser();
                    m_webView.IsScriptEnabled = true;

                    if (m_webViewClearCookies)
                    {
                        m_webViewClearCookies = false;
                        m_webView.ClearCookiesAsync();
                    }

                    m_webView.LoadCompleted    += new System.Windows.Navigation.LoadCompletedEventHandler(webBrowser_WebView_LoadCompleted);
                    m_webView.Navigating       += new EventHandler <NavigatingEventArgs>(webBrowser_Navigating);
                    m_webView.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(webBrowser_WebView_NavigationFailed);
                    m_webView.Navigated        += new EventHandler <System.Windows.Navigation.NavigationEventArgs>(webBrowser_Navigated);

                    MainPage.m_mainPage.LayoutRoot.Children.Add(m_webView);
                }

                String url = actionData;
                m_webView.Navigate(new Uri(url));

                return(true);
            }
            else if (action == "CCWebView::close")
            {
                if (m_webView != null)
                {
                    MainPage.m_mainPage.LayoutRoot.Children.Remove(m_webView);
                    m_webView = null;
                    MainPage.m_d3dInterop.csActionResult("CCWebView::closed", "");
                }

                return(true);
            }
            else if (action == "CCWebView::clearData")
            {
                if (m_webView != null)
                {
                    m_webView.ClearCookiesAsync();
                }
                else
                {
                    m_webViewClearCookies = true;
                }
                MainPage.m_d3dInterop.csActionResult("CCWebView::clearedData", "");

                return(true);
            }

            else if (action == "CCWebJS::openPage" || action == "CCWebJS::openFile")
            {
                if (m_webJS == null)
                {
                    m_webJS = new WebBrowser();
                    //m_webJS.ClearInternetCacheAsync();
                    m_webJS.IsScriptEnabled = true;

                    m_webJS.LoadCompleted    += new System.Windows.Navigation.LoadCompletedEventHandler(webBrowser_WebJS_LoadCompleted);
                    m_webJS.Navigating       += new EventHandler <NavigatingEventArgs>(webBrowser_Navigating);
                    m_webJS.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(webBrowser_WebJS_NavigationFailed);
                    m_webJS.Navigated        += new EventHandler <System.Windows.Navigation.NavigationEventArgs>(webBrowser_Navigated);
                }

                loadingWebJS = true;

                if (action == "CCWebJS::openPage")
                {
                    String url = actionData;
                    Uri    uri = new Uri(url);
                    m_webJS.Navigate(uri);
                }
                else
                {
                    //String filePath = actionData;
                    //using (StreamReader reader = new StreamReader(filePath))
                    //{
                    //    m_webJS.NavigateToString(reader.ReadToEnd());
                    //}
                    webBrowser_WebJS_OpenFile(actionData);
                }

                return(true);
            }
            else if (action == "CCWebJS::close")
            {
                if (m_webJS != null)
                {
                    m_webJS = null;
                    MainPage.m_d3dInterop.csActionResult("CCWebJS::closed", "");
                }

                return(true);
            }
            else if (action == "CCAppManager::WebBrowserOpen")
            {
                String         url  = actionData;
                WebBrowserTask task = new WebBrowserTask();
                task.Uri = new Uri(url);
                task.Show();

                MainPage.m_d3dInterop.csActionResult("CCAppManager::WebBrowserOpened", "");

                return(true);
            }

            return(false);
        }
Example #7
0
        public static void ClearCookies()
        {
            var webBrowser = new WebBrowser();

            webBrowser.ClearCookiesAsync();
        }
Example #8
0
        public bool csWork(String action, String actionData)
        {
            if (action == "CCWebView::openPage")
            {
                if (m_webView == null)
                {
                    m_webView = new WebBrowser();
                    m_webView.IsScriptEnabled = true;

                    if (m_webViewClearCookies)
                    {
                        m_webViewClearCookies = false;
                        m_webView.ClearCookiesAsync();
                    }

                    m_webView.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(webBrowser_WebView_LoadCompleted);
                    m_webView.Navigating += new EventHandler<NavigatingEventArgs>(webBrowser_Navigating);
                    m_webView.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(webBrowser_WebView_NavigationFailed);
                    m_webView.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(webBrowser_Navigated);

                    MainPage.m_mainPage.LayoutRoot.Children.Add(m_webView);
                }

                String url = actionData;
                m_webView.Navigate(new Uri(url));

                return true;
            }
            else if (action == "CCWebView::close")
            {
                if (m_webView != null)
                {
                    MainPage.m_mainPage.LayoutRoot.Children.Remove(m_webView);
                    m_webView = null;
                    MainPage.m_d3dInterop.csActionResult("CCWebView::closed", "");
                }

                return true;
            }
            else if (action == "CCWebView::clearData")
            {
                if (m_webView != null)
                {
                    m_webView.ClearCookiesAsync();
                }
                else
                {
                    m_webViewClearCookies = true;
                }
                MainPage.m_d3dInterop.csActionResult("CCWebView::clearedData", "");

                return true;
            }

            else if (action == "CCWebJS::openPage" || action == "CCWebJS::openFile")
            {
                if (m_webJS == null)
                {
                    m_webJS = new WebBrowser();
                    //m_webJS.ClearInternetCacheAsync();
                    m_webJS.IsScriptEnabled = true;

                    m_webJS.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(webBrowser_WebJS_LoadCompleted);
                    m_webJS.Navigating += new EventHandler<NavigatingEventArgs>(webBrowser_Navigating);
                    m_webJS.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(webBrowser_WebJS_NavigationFailed);
                    m_webJS.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(webBrowser_Navigated);
                }

                loadingWebJS = true;

                if (action == "CCWebJS::openPage")
                {
                    String url = actionData;
                    Uri uri = new Uri(url);
                    m_webJS.Navigate(uri);
                }
                else
                {
                    //String filePath = actionData;
                    //using (StreamReader reader = new StreamReader(filePath))
                    //{
                    //    m_webJS.NavigateToString(reader.ReadToEnd());
                    //}
                    webBrowser_WebJS_OpenFile(actionData);
                }

                return true;
            }
            else if (action == "CCWebJS::close")
            {
                if (m_webJS != null)
                {
                    m_webJS = null;
                    MainPage.m_d3dInterop.csActionResult("CCWebJS::closed", "");
                }

                return true;
            }
            else if (action == "CCAppManager::WebBrowserOpen")
            {
                String url = actionData;
                WebBrowserTask task = new WebBrowserTask();
                task.Uri = new Uri(url);
                task.Show();

                MainPage.m_d3dInterop.csActionResult("CCAppManager::WebBrowserOpened", "");

                return true;
            }

            return false;
        }