本文整理汇总了C#中System.Windows.Forms.WebBrowserNavigatedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# WebBrowserNavigatedEventArgs类的具体用法?C# WebBrowserNavigatedEventArgs怎么用?C# WebBrowserNavigatedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebBrowserNavigatedEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了WebBrowserNavigatedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: webBrowser1_Navigated
private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
this.Left = 0;
this.Top = 0;
this.Width = this.ParentForm.Width;
this.Height = this.ParentForm.Height-50;
}
示例2: browser_Navigated
private void browser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
//Console.WriteLine(e.Url);
var pattern = @"code=([\d|a-zA-Z]*)";
if (Regex.IsMatch(e.Url.Query, pattern))
{
panelMask.Visible = true;
panelMask.BringToFront();
var code = Regex.Match(e.Url.Query, pattern).Groups[1].Value;
Task.Factory.StartNew(() =>
{
OpenAuth.GetAccessTokenByCode(code);
UpdateUI(() =>
{
if (OpenAuth.IsAuthorized)
{
Code = code;
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
else
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
});
});
}
}
示例3: LoginBrowser_Navigated
private void LoginBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
if (e.Url.ToString().Contains("#"))
{
Regex r = new Regex(@"\{(.*)\}");
string[] json = r.Match(e.Url.ToString()).Value.Replace("{", "").Replace("}", "").Replace("\"", "").Split(',');
Hashtable h = new Hashtable();
foreach (string str in json)
{
string[] kv = str.Split(':');
h[kv[0]] = kv[1];
}
this.si = new SessionInfo();
this.si.AppId = this.AppId;
this.si.Permissions = this.Permissions;
this.si.MemberId = (string)h["mid"];
this.si.SessionId = (string)h["sid"];
this.si.Expire = Convert.ToInt32(h["expire"]);
this.si.Secret = (string)h["secret"];
this.si.Signature = (string)h["sig"];
this.LoginInfoReceived = true;
this.Close();
}
}
示例4: browser_Navigated
private void browser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
lblLoading.Visible = false;
txtHtmlView.Text = browser.DocumentText;
IHTMLDocument2 doc2 = browser.Document.DomDocument as IHTMLDocument2;
// doc2.designMode = "On";
}
示例5: webBrowser1_Navigated
private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
string responsed = e.Url.ToString();
if (responsed.StartsWith("http://localhost/inverify"))
{
responsed = responsed.Replace("http://localhost/inverify?", "");
string[] args = responsed.Split('&');
foreach(string arg in args)
{
string[] values = arg.Split('=');
if(values[0] == "oauth_token")
oauth_token = values[1];
if(values[0] == "oauth_verifier")
oauth_verifier = values[1];
}
}
if (oauth_token != null && oauth_verifier != null)
{
if (AuthorizeCompleted != null)
{
AuthorizeCompleted(oauth_token, oauth_verifier);
oauth_token = null;
oauth_verifier = null;
}
tmrCloseCheck.Interval = 2000;
tmrCloseCheck.Tick += new EventHandler(tmrCloseCheck_Tick);
tmrCloseCheck.Start();
ShowOfflienContent("Completed.htm");
}
}
示例6: LoginBrowser_Navigated
private void LoginBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
if (e.Url.ToString().Contains("#"))
{
string id="", expires="", token="", get=e.Url.ToString();
try
{
get = get.Split('#')[1]; //erase trash like http:
token = get.Split('&')[0].Split('=')[1]; //take string between = and &
expires = get.Split('=')[2].Split('&')[0]; //take expires_in=__&
id = get.Split('=')[3];//get user id, its 3 '='
}
catch { }
this.si = new SessionInfo();
this.si.AppId = this.AppId;
this.si.Permissions = this.Permissions;
this.si.Token = token;
this.si.UserId = Convert.ToInt32(id);
this.si.Expire = Convert.ToInt32(expires);
this.LoginInfoReceived = true;
this.Close();
}
}
示例7: WebBrowser_Navigated
private async void WebBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
// Check if the current URL contains the authorization token
var authorizationCode = OneDriveApi.GetAuthorizationTokenFromUrl(e.Url.ToString());
// Verify if an authorization token was successfully extracted
if (!string.IsNullOrEmpty(authorizationCode))
{
// Get an access token based on the authorization token that we now have
await OneDriveApi.GetAccessToken();
if (OneDriveApi.AccessToken != null)
{
DialogResult = DialogResult.OK;
Close();
return;
}
}
// If we're on this page, but we didn't get an authorization token, it means that we just signed out, proceed with signing in again
if (e.Url.ToString().StartsWith(OneDriveApi.SignoutUri))
{
var authenticateUri = OneDriveApi.GetAuthenticationUri();
WebBrowser.Navigate(authenticateUri);
}
}
示例8: OnNavigated
private async void OnNavigated(object sender, WebBrowserNavigatedEventArgs e)
{
Debug.WriteLine("Navigated " + e.Url);
// Pre-Authorization performed?
if (m_isPreAuthorization)
{
m_isPreAuthorization = false;
m_browser.Navigate(m_provider.AuthorizationUrl);
return;
}
// we need to ignore all navigation that isn't to the redirect uri.
if (!e.Url.ToString().StartsWith(m_provider.RedirectionUrl.ToString(), StringComparison.OrdinalIgnoreCase))
{
return;
}
try
{
var isOk = await m_provider.Claim(e.Url, m_browser.DocumentTitle);
DialogResult = isOk ? DialogResult.OK : DialogResult.Cancel;
}
catch
{
DialogResult = DialogResult.Cancel;
}
finally
{
m_browser.Stop();
Close();
}
}
示例9: webBrowser1_Navigated
private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
if (Process.HasExited)
{
MessageBox.Show("WebServer did not start correctly. Exited with code: " + Process.ExitCode, "Error");
}
}
示例10: webBrowser1_Navigated
void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
if (e.Url.ToString().IndexOf("http://oauth.vk.com/blank.html") != -1)
{
var urlParams = HttpUtility.ParseQueryString(e.Url.Fragment.Substring(1));
ACCESS_TOKEN = urlParams.Get("access_token");
USER_ID = urlParams.Get("user_id");
/*string uriString =
string.Format("https://api.vk.com/method/{0}.xml?oid={1}&access_token={2}",
"audio.get", "6811515", ACCESS_TOKEN);
webBrowser1.Navigate(uriString);*/
request();
}
/* if (e.Url.AbsolutePath.ToString().IndexOf("/method/audio.get.xml") != -1)
{
XmlDocument xd = new XmlDocument();
xd.LoadXml(webBrowser1.DocumentText.ToString().Replace(" "," "));
//XmlNodeList urls = xd.SelectNodes()
//var document = xd.Load(webBrowser1.DocumentStream);
}*/
}
示例11: webBrowser_Navigated
private void webBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
if (e.Url.AbsoluteUri.StartsWith(this.RedirectURL))
{
//http://localhost/#access_token=5dlpafwfntadj2cubro3vramcnp4c6&scope=user_read+user_subscriptions
//{http://localhost/?error=access_denied&error_description=The+user+denied+you+access}
var startIndex = e.Url.AbsoluteUri.IndexOf("#") + 1;
var response = e.Url.AbsoluteUri.Substring(startIndex);
var qs = System.Web.HttpUtility.ParseQueryString(response);
var access_token = qs["access_token"];
if (string.IsNullOrWhiteSpace(access_token))
{
Application.Exit();
return;
}
var twitchAlerts = new Alerts(access_token, this.ClientId);
this.Hide();
}
else if (e.Url.AbsoluteUri.StartsWith("https://api.twitch.tv/"))
{
this.Show();
}
}
示例12: webBrowser1_Navigated
private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
string urlFragment; // фрагмент параметров авторизации
if (e.Url.AbsolutePath == "/blank.html") // Если абсолютный урл равен, то авторизация прошла
urlFragment = webBrowser1.Url.Fragment;
else
urlFragment = ifLoadLogin();
if (urlFragment.IndexOf("error") != -1 || urlFragment == "") // Если авторизация прошла с ошибкой
{
this.DialogResult = DialogResult.Cancel;
return;
}
if (urlFragment.IndexOf("error") == -1) // Если нет ошибок, берём токен, время жизни и наш айди
{
vars.VARS.Token = urlFragment.Substring(14, urlFragment.IndexOf("&") - 14);
urlFragment = urlFragment.Remove(0, urlFragment.IndexOf("&") + 1);
vars.VARS.Expire = Convert.ToUInt32(urlFragment.Substring(11, urlFragment.IndexOf("&") - 11));
urlFragment = urlFragment.Remove(0, urlFragment.IndexOf("&"));
vars.VARS.Mid = Convert.ToUInt32(urlFragment.Substring(9, urlFragment.Length - 9));
}
this.DialogResult = DialogResult.OK; // Возвращаем сообщение об успехе
}
示例13: webBrowser1_Navigated
private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
try
{
Uri url = e.Url;
if (url.AbsolutePath == "/blank.html")
{
var q = HttpUtility.ParseQueryString(url.Fragment.Substring(1));
if (q["error"] != null)
{
onError(q["error"], q["error_description"]);
}
else
{
onSuccess(q["user_id"], q["access_token"]);
}
Hide();
var timer = new System.Threading.Timer(_ =>
{
Close();
}, null, 10000, Timeout.Infinite);
}
}
catch (Exception ex)
{
onError(ex.Message, "");
}
}
示例14: wbFacebookLogin_Navigated
private void wbFacebookLogin_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
if (e.Url.PathAndQuery.Contains("desktopapp.php"))
{
DialogResult = DialogResult.OK;
}
}
开发者ID:jeffdeville,项目名称:FacebookDeveloperToolkit---Fork-at-37335,代码行数:7,代码来源:FacebookAuthentication.cs
示例15: webBrowser_Navigated
private void webBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
{
//System.Diagnostics.Debug.WriteLine("Navigated to: " + webBrowser1.Url.AbsoluteUri.ToString());
// 브라우저의 html의 타이틀 값을 가져온다(이 타이틀에 code값이 적혀 있음)
if(option == LoginOption.GoogleDrive)
{
this.Text = webBrowser1.Document.Title;
if (this.webBrowser1.Document.Title.StartsWith(EndUrl))
{
// 타이틀에 적혀 있는 값을 필요한 부분만 잘라서 code에 저장
this.code = AuthResult(webBrowser1.Document.Title);
CloseWindow();
}
}
else if(option == LoginOption.OneDrive)
{
if (this.webBrowser1.Url.AbsoluteUri.StartsWith(EndUrl))
{
string[] querparams = webBrowser1.Url.Query.TrimStart('?').Split('&');
int index = querparams[0].IndexOf('=');
querparams[0] = querparams[0].Substring(index+1, (querparams[0].Length - index)-1);
this.code = querparams[0];
CloseWindow();
}
}
else if(option == LoginOption.DropBox)
{
if(webBrowser1.Document.GetElementById("auth-code") != null)
{
webBrowser1.Visible = false;
this.code = webBrowser1.Document.GetElementById("auth-code").InnerText;
CloseWindow();
}
}
}