本文整理汇总了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();
}
}
示例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();
}
}
示例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);
}
}
示例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;
}
}
}
示例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;
}
示例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]);
}
示例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;
}
}
}
示例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));
}
示例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();
}
}
示例10: WebBrowser_OnNavigating
private void WebBrowser_OnNavigating(object sender, NavigatingEventArgs e)
{
if (!RHODESAPP().HttpServer.processBrowserRequest(e.Uri))
return;
e.Cancel = true;
}
示例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);
}
}
示例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());
}
}
}
}
示例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);
});
}
示例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;
}
}
示例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));
}
}