Represents the event information for a Navigating event.
Inheritance: CancelEventArgs
コード例 #1
0
ファイル: LoginPage.xaml.cs プロジェクト: Rwprice/Twitchy
        async void WebBrowser_Navigating(object sender, NavigatingEventArgs e)
        {
            if (e.Uri.Host == "localhost")
            {
                if (e.Uri.AbsoluteUri.Contains("error=access_denied"))
                    Debug.WriteLine("Login was cancelled");

                else
                {
                    string token = e.Uri.AbsoluteUri.Substring(e.Uri.AbsoluteUri.IndexOf('=') + 1);
                    token = token.Remove(token.IndexOf('&'));

                    var user = await User.GetUserFromOauth(token);

                    User.SaveUser(user);

                    App.ViewModel.user = user;                    
                }

                await this.WebBrowser.ClearCookiesAsync();
                await this.WebBrowser.ClearInternetCacheAsync();

                NavigationService.GoBack();
            }
        }
コード例 #2
0
        async void oAuthBrowser_Navigating(object sender, NavigatingEventArgs e)
        {
            var response = e.Uri.ToString();
            if (response.LastIndexOf("access_token=") != -1)
            {
                var session = SFDC.SFDCSession.Instance;

                var parametros = response.Substring(response.IndexOf("#")+1).Split('&');
                foreach (var parametro in parametros)
                {
                    var name = parametro.Split('=')[0];
                    if (name == "access_token")
                        session.AccessToken = parametro.Split('=')[1];

                    if (name == "refresh_token")
                    {
                        session.RefreshToken = parametro.Substring("refresh_token=".Length);           
                    }

                    if (name == "instance_url")
                    {
                        session.InstanceUrl = parametro.Split('=')[1];
                        IsolatedStorageSettings.ApplicationSettings[SFDCSession.URL_INSTANCE] = session.InstanceUrl;
                    }

                }
                e.Cancel = true;                
                await oAuthBrowser.ClearCookiesAsync();
                await oAuthBrowser.ClearInternetCacheAsync();
                
                NavigationService.GoBack();
            }
        }
コード例 #3
0
ファイル: Login.xaml.cs プロジェクト: tmrudick/splitwise-wp8
        private async void LoginBrowser_Navigating(object sender, NavigatingEventArgs e)
        {
            // Hide the splash screen
            SplashScreen.Visibility = System.Windows.Visibility.Collapsed;

            if (e.Uri.AbsoluteUri.Contains("oauth.tomrudick.com"))
            {
                // Hide the browser window so the user doesn't see a bunch of OAuth redirection page flashes.
                LoginBrowser.Visibility = System.Windows.Visibility.Collapsed;

                var qs = HttpHelpers.ParseQueryString(e.Uri.Query);

                var verifier = qs["oauth_verifier"];
                var request = new RestRequest("get_access_token", Method.POST);
                client.Authenticator = OAuth1Authenticator.ForAccessToken(consumerKey, consumerSecret, this.oauth_token, this.oauth_token_secret, verifier);

                var response = await client.ExecuteRequestAsync(request);
                qs = HttpHelpers.ParseQueryString(response.Content);

                this.oauth_token = qs["oauth_token"];
                this.oauth_token_secret = qs["oauth_token_secret"];

                OAuthCredentials credentials = new OAuthCredentials() {
                    OAuthToken = this.oauth_token,
                    OAuthTokenSecret = this.oauth_token_secret,
                    OAuthVerifier = verifier
                };

                // Save to isolated storage
                storage["credentials"] = credentials;
                storage.Save();

                CompleteLogin(credentials);
            }
        }
コード例 #4
0
        private void oauthBrowser_Navigating(object sender, NavigatingEventArgs e)
        {
            if (e.Uri.Host.Equals(_callbackUri.Host)) 
            {
                e.Cancel = true;

                // grab oauth_token and oauth_verifier
                IDictionary<string, string> keyDictionary = new Dictionary<string, string>();
                var qSplit = e.Uri.Query.Split('?');
                foreach (var kvp in qSplit[qSplit.Length - 1].Split('&'))
                {
                    var kvpSplit = kvp.Split('=');
                    if (kvpSplit.Length == 2)
                    {
                        keyDictionary.Add(kvpSplit[0], kvpSplit[1]);
                    }
                }

                VerifierCode = keyDictionary["oauth_verifier"];

                if (VerifiedCodeReceived != null)
                {
                    VerifiedCodeReceived(this, new EventArgs() { });
                    oauthBrowser.Visibility = Visibility.Collapsed;
                }
            }
        }
コード例 #5
0
        public void Navigate(UserControl page)
        {
            YellowstonePathology.UI.Navigation.NavigatingEventArgs eventArgs = new NavigatingEventArgs(this.m_CurrentPage, page);

            this.m_CurrentPage = page;
            this.m_ContentControl.Content = page;
        }
コード例 #6
0
        private void BrowserNavigating(object sender, NavigatingEventArgs e)
        {
            if (m_bIsCompleted)
                return;

            if (e.Uri.AbsoluteUri.Contains("error=access_denied"))
            {
                if (null != OBrowserCancelled)
                    OBrowserCancelled.Invoke(sender, e);
                m_bIsCompleted = true;
                return;
            }

            if (!e.Uri.AbsoluteUri.Contains("code="))
            {
                return;
            }

            // 下面是拿code换token的部分喽

            m_bIsCompleted = true;
            var arguments = e.Uri.AbsoluteUri.Split('?');
            if (0 == arguments.Length)
            {
                m_Error.errCode = DoubanSdkErrCode.SERVER_ERR;

                if (null != OAuth2VerifyCompleted)
                    OAuth2VerifyCompleted(false, m_Error, null);

                return;
            }

            GetOAuth2AccessToken(arguments[1]);
        }
コード例 #7
0
 private void AuthorizeWebBrowser_Navigating(object sender, NavigatingEventArgs e)
 {
     if (e.Uri.Query.Contains("code="))
     {
         App.ViewModel.RetrieveAccessToken(e.Uri.Query.Split('=')[1]);
         NavigationService.GoBack();
     }
     else
     {
         var paths = e.Uri.LocalPath.Split('/');
         switch (paths[paths.Length - 1])
         {
             case "login":
             case "auth":
             case "confirm":
             case "accept":
                 // ignore
                 break;
             default:
                 MessageBox.Show("Authorization Failed");
                 NavigationService.GoBack();
                 break;
         }
     }
 }
コード例 #8
0
ファイル: MainPage.xaml.cs プロジェクト: artemk/rhodes
        private void WebBrowser_OnNavigating(object sender, NavigatingEventArgs e)
        {
            if(!e.Uri.OriginalString.StartsWith(RHODESAPP().getHomeUrl()) 
               && (e.Uri.IsAbsoluteUri || e.Uri.OriginalString.StartsWith("res:")))
                return;

            String query = "";
            String url = e.Uri.OriginalString;
            url = url.StartsWith(RHODESAPP().getHomeUrl()) ? url.substring(RHODESAPP().getHomeUrl().length()) : url;

            int nFrag = url.LastIndexOf('#');
            if ( nFrag >= 0 )
                url = url.Substring(0, nFrag);

            int nQuery = url.IndexOf('?');
            if (nQuery >= 0)
            {
                query = url.Substring(nQuery + 1);
                url = url.Substring(0, nQuery);
            }

            rho.net.CHttpServer.CResponse resp = RHODESAPP().HttpServer.decide("GET", url, query, "");

            if (!resp.m_bRedirect)
                return;

            e.Cancel = true;
            webBrowser1.IsScriptEnabled = true;
            webBrowser1.Navigate(new Uri(resp.m_strUrl, UriKind.Relative));
        }
コード例 #9
0
ファイル: MainPage.xaml.cs プロジェクト: jksulkow/KoalaQuest
        // Intercept external links and open in the browser

        void Browser_Navigating(object sender, NavigatingEventArgs e)
        {
            String scheme = null;

            try
            {
                scheme = e.Uri.Scheme;
            }
            catch
            {
            }

            if (scheme == null || scheme == "file")
                return;
            // Not going to follow any other link
            e.Cancel = true;
            if (scheme == "http")
            {
                // start it in Internet Explorer
                WebBrowserTask webBrowserTask = new WebBrowserTask();
                webBrowserTask.Uri = new Uri(e.Uri.AbsoluteUri);
                webBrowserTask.Show();
            }
            if (scheme == "mailto")
            {
                EmailComposeTask emailComposeTask = new EmailComposeTask();
                emailComposeTask.To = e.Uri.AbsoluteUri;
                emailComposeTask.Show();
            }
        }
コード例 #10
0
ファイル: MainPage.xaml.cs プロジェクト: douglaslise/rhodes
        private void WebBrowser_OnNavigating(object sender, NavigatingEventArgs e)
        {
            if (!RHODESAPP().HttpServer.processBrowserRequest(e.Uri))
                return;

            e.Cancel = true;
        }
コード例 #11
0
        private void BrowserNavigating(object sender, NavigatingEventArgs e)
        {
            BrowserGrid.Visibility = Visibility.Collapsed;
            Progress.Visibility = Visibility.Visible;

            var url = e.Uri.ToString();
            var callbackHandler = new CallbackHandler();
            var result = callbackHandler.ParseAccessToken(url);

            if (result.Status != CallbackStatus.Success)
            {
                //If we are being navigated away from the API domain, lets error :)
                if (!UrlWithinKnownWaters(e))
                {
                    DisplayError();
                }

                return;
            }

            e.Cancel = true;

            if (OnClose != null)
            {
                OnClose();
            }

            if (OnKeyFound != null)
            {
                OnKeyFound(result.Token);
            }
        }
        void browser_Navigating(object sender, NavigatingEventArgs e)
        {
            // Tumblr is redirecting us to the callback site
            if (e.Uri.AbsoluteUri.Contains("tomrudick.com"))
            {
                // Stop the navigation!
                e.Cancel = true;

                // Get the verifier from the redirect URL
                string[] uriParts = e.Uri.AbsoluteUri.Split('?');

                if (uriParts.Length == 2)
                {
                    // Verify that the auth token we have matches the auth token back from the browser
                    if (this.oauthToken.Equals(Common.GetValueFromQueryString(uriParts[1], "oauth_token")))
                    {
                        string verifier = Common.GetValueFromQueryString(uriParts[1], "oauth_verifier");

                        // Store the verifier so that we can get it on the other page
                        // TODO: I don't like this... I want to just pass it back through a URI or something
                        IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
                        settings.Add("oauth_verifier", verifier);

                        // Set this field so we know where we are coming from...
                        settings.Add("from_browser", true);

                        // Send the user back to the previous page
                        Dispatcher.BeginInvoke(() => NavigationService.GoBack());
                    }
                }
            }
        }
コード例 #13
0
        private void BrowserNavigating(object sender, NavigatingEventArgs e)
        {
            //QQ 空间授权成功后直接返回token,不需要用code换取token
            if (currentType == SocialType.QZone && e.Uri.AbsoluteUri.Contains("access_token"))
            {
                //http://qzs.qq.com/open/mobile/login/proxy.html?&t=1363316329#&openid=&appid=100394029&access_token=D1600ED336D42D024DFB5A0618A56B8C&key=270e66a425575f5130efe0d416252469&serial=&token_key=&browser=0&browser_error=0&status_os=&sdkv=&status_machine=
                AccessToken token = new AccessToken();
                token.Token = QueryStringHelper.GetQueryString(e.Uri, "access_token");
                token.OpenId = QueryStringHelper.GetQueryString(e.Uri, "openid");
                action(token);
                return;
            }

            if (!e.Uri.AbsoluteUri.Contains("code=") && !e.Uri.AbsoluteUri.Contains("code ="))
            {
                return;
            }
            var arguments = e.Uri.AbsoluteUri.Split('?');
            string code = arguments[1];
            if (currentType == SocialType.Tencent)
            {
                var sp = arguments[1].Split('&');
                code = sp[0];

                //open id
                client.Tag = sp[1].Split('=')[1];
            }

            SocialKit.GetToken(currentType, client, code, (p) =>
            {
                action(p);
            });
        }
コード例 #14
0
ファイル: RssDetails.xaml.cs プロジェクト: thankcreate/Care
 private void BrowserNavigating(object sender, NavigatingEventArgs e)
 {
     string a = e.Uri.AbsoluteUri;
     if (e.Uri.AbsoluteUri.Contains("closeWindow()") || e.Uri.AbsoluteUri.Contains("error=access_denied"))
     {
         int bbb = 1;
     }
 }
コード例 #15
0
ファイル: MainPage.xaml.cs プロジェクト: jldavid/waterlog
 private void Browser_Navigating(object sender, NavigatingEventArgs e)
 {
     if (e.Uri.ToString().Contains("/index.html"))
     {
         e.Cancel = true;
         this.CordovaView.Browser.Navigate(new Uri("/app/www/" + GetFileName(), UriKind.Relative));
     }
 }
コード例 #16
0
 void TheWebView_Navigating(object sender, NavigatingEventArgs e)
 {
     if (!loadedPage)
     {
         return;
     }
    
     e.Cancel = true;
 }
コード例 #17
0
ファイル: TweetDetails.xaml.cs プロジェクト: kssagra/SagraEmi
        private void Browser_Navigating(object sender, NavigatingEventArgs e)
        {
            e.Cancel = true;

            var task = new WebBrowserTask {
                Uri = e.Uri,
            };
            task.Show ();
        }
 /// <summary>Callback of browser navigating.</summary>
 private void OnBrowserNavigating(object sender, NavigatingEventArgs e)
 {
     // The code or the error should be received by localhost.
     if (e.Uri.Host == "localhost")
     {
         var query = e.Uri.Query.Substring(1);
         tcsAuthorizationCodeResponse.SetResult(new AuthorizationCodeResponseUrl(query));
     }
 }
コード例 #19
0
 private void RenrenBrowser_Navigating(object sender, NavigatingEventArgs e)
 {
     if (LoadCompleted != null)
     {
         System.Windows.Deployment.Current.Dispatcher.BeginInvoke(delegate()
         {
             LoadCompleted(this, e);
         });
     }
 }
コード例 #20
0
 void browser_Navigating(object sender, NavigatingEventArgs e)
 {
     e.Cancel = true;
     if (e.Uri.IsAbsoluteUri && (e.Uri.Scheme.ToLower() == "http" || e.Uri.Scheme.ToLower() == "https"))
     {
         WebBrowserTask task = new WebBrowserTask();
         task.Uri = e.Uri;
         task.Show();
     }
 }
コード例 #21
0
 void AuthorizeWB_Navigating(object sender, NavigatingEventArgs e)
 {
     if (e.Uri.OriginalString.Contains("access_token"))
     {
         List<Parameter> tokenvalues = HttpUtil.GetParameters(e.Uri.OriginalString);
         OauthKey oauthKey = new OauthKey();
         oauthKey.tokenKey = tokenvalues[0].Value;
         oauthKey.expiredTime = (TimeStamp.GetCurTimeStamp() + long.Parse(tokenvalues[1].Value)).ToString();
     }
 }
コード例 #22
0
ファイル: OAuthModel.cs プロジェクト: rafaelwinter/Ocell
 public virtual void BrowserNavigating(NavigatingEventArgs e)
 {
     if (e != null && e.Uri != null && !string.IsNullOrEmpty(e.Uri.Host)
         && e.Uri.AbsoluteUri.StartsWith(callbackUrl))
     {
         e.Cancel = true;
         BrowserVisible = false;
         IsLoading = true;
         ReturnedToCallback(e.Uri);
     }
 }
コード例 #23
0
        private void _browser_Navigating(object sender, NavigatingEventArgs e)
        {
            if (e.Uri.ToString().StartsWith(_callbackUrl) && NavigationService.CanGoBack)
            {
                NavigationService.GoBack();

                var han = Finished;
                if (han != null)
                    han(this, new EventArgs());
            }
        }
コード例 #24
0
ファイル: MainPage.xaml.cs プロジェクト: rrmartins/rhodes
        private void WebBrowser_OnNavigating(object sender, NavigatingEventArgs e)
        {
           /* if (e.Uri.AbsoluteUri.Equals("http://www.google.com/") )
            {
                e.Cancel = true;
                webBrowser1.Navigate(new Uri("http://www.yahoo.com", UriKind.Absolute));
            }*/

            //string strPage = webBrowser1.SaveToString();
            //if (strPage != null)
            //    return;
        }
コード例 #25
0
        void MetroistWebBrowser_Navigating(object sender, NavigatingEventArgs e)
        {
            var url = e.Uri.ToString();
            if (url.StartsWith("http://localhost"))
            {
                MetroistWebBrowser.Visibility = Visibility.Collapsed;
                SetGoogleCode(url);
            }

            progressIndicator.IsVisible = true;
            SystemTray.SetProgressIndicator(this, progressIndicator);
        }
コード例 #26
0
ファイル: PageNavigator.cs プロジェクト: ericramses/YPILIS
        public void Navigate(UserControl page)
        {
            if(this.m_CurrentPage is UI.PageControl)
            {
                ((UI.PageControl)this.m_CurrentPage).BeforeNavigatingAway();
            }

            YellowstonePathology.UI.Navigation.NavigatingEventArgs eventArgs = new NavigatingEventArgs(this.m_CurrentPage, page);

            this.m_CurrentPage = page;
            this.m_ContentControl.Content = page;
        }
コード例 #27
0
        void webBrowser_Navigating(object sender, NavigatingEventArgs e)
        {
            if (e.Uri.ToString().StartsWith(JobApi.URL_CALLBACK))
            {
                //e.Cancel = true;
             //   webBrowser.Navigate(e.Uri);
                var request = (HttpWebRequest)WebRequest.Create(e.Uri);

               // CookieContainer myCookieContainer = request.CookieContainer;
                //CookieCollection c = myCookieContainer.GetCookies(new Uri(JobApi.JOBHUB_DOMAIN));
            }
        }
コード例 #28
0
        private void WebBrowser1_Navigating(object sender, NavigatingEventArgs e)
        {
            // if we are not navigating to the callback url then authentication is not complete.
            if (!e.Uri.AbsoluteUri.StartsWith(callbackUrl)) return;

            // Get "oauth_verifier" part of the query string.
            var oauthVerifier = e.Uri.Query.Split('&')
                .Where(s => s.Split('=')[0] == "oauth_verifier")
                .Select(s => s.Split('=')[1])
                .FirstOrDefault();

            if (String.IsNullOrEmpty(oauthVerifier))
            {
                MessageBox.Show("Unable to find Verifier code in uri: " + e.Uri.AbsoluteUri);
                return;
            }

            // Found verifier, so cancel navigation
            e.Cancel = true;

            // Obtain the access token from Flickr
            Flickr f = FlickrManager.GetInstance();

            f.OAuthGetAccessTokenAsync(requestToken, oauthVerifier, r =>
            {
                // Check if an error was returned
                if (r.Error != null)
                {
                    Dispatcher.BeginInvoke(() =>
                    {
                        MessageBox.Show("An error occurred getting the access token: " + r.Error.Message);
                    });
                    return;
                }

                accessToken = r.Result;

                // Save the oauth token for later use
                FlickrManager.OAuthToken = accessToken.Token;
                FlickrManager.OAuthTokenSecret = accessToken.TokenSecret;
                FlickrManager.OAuthUserID = accessToken.UserId;

                Dispatcher.BeginInvoke(() =>
                {
                    //MessageBox.Show("Authentication completed for user " + accessToken.FullName + ", with token " + accessToken.Token);
                    NavigationService.Navigate(new Uri("/" + "MainPage" + ".xaml", UriKind.Relative));
                    return;
                });

            });

        }
コード例 #29
0
        void Browser_Navigating(object sender, NavigatingEventArgs e)
        {
            SetVisualState(true);
            Debug.WriteLine("PayU internal navigation: {0}", e.Uri.OriginalString);

            if (e.Uri.OriginalString.Contains(PayuService._successUri.OriginalString))
            {
                SetTransactionResult(TransactionResult.Status.Succeed);
            }
            else if (e.Uri.OriginalString.Contains(PayuService._errorUri.OriginalString))
            {
                SetTransactionResult(TransactionResult.Status.Failed, Translations.LanguageResources.TransactionFailedError);
            }
        }
コード例 #30
0
        private void WebBrowser1_Navigating(object sender, NavigatingEventArgs e)
        {
            
            if (!e.Uri.AbsoluteUri.StartsWith(callbackUrl)) return;

           var oauthVerifier = e.Uri.Query.Split('&')
                .Where(s => s.Split('=')[0] == "oauth_verifier")
                .Select(s => s.Split('=')[1])
                .FirstOrDefault();

            if (String.IsNullOrEmpty(oauthVerifier))
            {
                MessageBox.Show(AppResources.VerifierError + e.Uri.AbsoluteUri);
                return;
            }

            
            e.Cancel = true;

         
            Flickr f = FlickrManager.GetInstance();

            f.OAuthGetAccessTokenAsync(requestToken, oauthVerifier, r =>
            {
                if (r.Error != null)
                {
                    Dispatcher.BeginInvoke(() =>
                    {
                        MessageBox.Show(AppResources.AccessTokenError + r.Error.Message);
                    });
                    return;
                }
                WebBrowser1.Visibility = System.Windows.Visibility.Collapsed;
                OAuthAccessToken accessToken = r.Result;

                // Save the oauth token for later use
                FlickrManager.OAuthToken = accessToken.Token;
                FlickrManager.OAuthTokenSecret = accessToken.TokenSecret;
                // Save user for later use
                App.Current.uvm.AddUser(accessToken.UserId, accessToken.Username);
                               
                Dispatcher.BeginInvoke(() =>
                {
                   NavigationService.GoBack();
                });

            });

        }