当前位置: 首页>>代码示例>>C#>>正文


C# Controls.NavigatingEventArgs类代码示例

本文整理汇总了C#中System.Windows.Controls.NavigatingEventArgs的典型用法代码示例。如果您正苦于以下问题:C# NavigatingEventArgs类的具体用法?C# NavigatingEventArgs怎么用?C# NavigatingEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NavigatingEventArgs类属于System.Windows.Controls命名空间,在下文中一共展示了NavigatingEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WebBrowser_Navigating

        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();
            }
        }
开发者ID:Rwprice,项目名称:Twitchy,代码行数:25,代码来源:LoginPage.xaml.cs

示例2: oAuthBrowser_Navigating

        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();
            }
        }
开发者ID:VicNaranja,项目名称:SalesforceBase,代码行数:33,代码来源:Login.xaml.cs

示例3: LoginBrowser_Navigating

        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);
            }
        }
开发者ID:tmrudick,项目名称:splitwise-wp8,代码行数:35,代码来源:Login.xaml.cs

示例4: oauthBrowser_Navigating

        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;
                }
            }
        }
开发者ID:nagyistge,项目名称:Copy-.Net-SDK,代码行数:27,代码来源:OAuth2Sample.xaml.cs

示例5: Navigate

        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;
        }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:7,代码来源:PageNavigator.cs

示例6: BrowserNavigating

        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]);
        }
开发者ID:thankcreate,项目名称:Care,代码行数:34,代码来源:OAuth2Control.xaml.cs

示例7: AuthorizeWebBrowser_Navigating

 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;
         }
     }
 }
开发者ID:ptyork,项目名称:CanvasWP,代码行数:25,代码来源:WebAuthorizePage.xaml.cs

示例8: WebBrowser_OnNavigating

        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));
        }
开发者ID:artemk,项目名称:rhodes,代码行数:30,代码来源:MainPage.xaml.cs

示例9: Browser_Navigating

        // 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();
            }
        }
开发者ID:jksulkow,项目名称:KoalaQuest,代码行数:32,代码来源:MainPage.xaml.cs

示例10: WebBrowser_OnNavigating

        private void WebBrowser_OnNavigating(object sender, NavigatingEventArgs e)
        {
            if (!RHODESAPP().HttpServer.processBrowserRequest(e.Uri))
                return;

            e.Cancel = true;
        }
开发者ID:douglaslise,项目名称:rhodes,代码行数:7,代码来源:MainPage.xaml.cs

示例11: BrowserNavigating

        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);
            }
        }
开发者ID:jbouwens,项目名称:Put.io.Wp,代码行数:32,代码来源:ApiKeyFetcher.xaml.cs

示例12: browser_Navigating

        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());
                    }
                }
            }
        }
开发者ID:tmrudick,项目名称:wp7-tumblr-photo-uploader,代码行数:32,代码来源:WebBrowserAuthorizationPage.xaml.cs

示例13: BrowserNavigating

        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);
            });
        }
开发者ID:kamaelyoung,项目名称:social_share,代码行数:33,代码来源:AuthControl.xaml.cs

示例14: BrowserNavigating

 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;
     }
 }
开发者ID:thankcreate,项目名称:Care,代码行数:8,代码来源:RssDetails.xaml.cs

示例15: Browser_Navigating

 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));
     }
 }
开发者ID:jldavid,项目名称:waterlog,代码行数:8,代码来源:MainPage.xaml.cs


注:本文中的System.Windows.Controls.NavigatingEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。