本文整理汇总了C#中System.Windows.Controls.WebBrowser.Navigate方法的典型用法代码示例。如果您正苦于以下问题:C# WebBrowser.Navigate方法的具体用法?C# WebBrowser.Navigate怎么用?C# WebBrowser.Navigate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.WebBrowser
的用法示例。
在下文中一共展示了WebBrowser.Navigate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: autorize
public static void autorize(WebBrowser _webBrowser)
{
string clientID = "4273691";
string url = string.Format("http://oauth.vk.com/authorize?client_id={0}&scope=friends,audio&redirect_uri=https://oauth.vk.com/blank.html&display=popup&response_type=token", clientID);
_webBrowser.Navigated += _webBrowser_Navigated;
_webBrowser.Navigate(url);
}
示例2: RunTabItem
public RunTabItem (string header)
{
FrameName = "";
this.Header = header;
WebBrowser = new WebBrowser();
WebBrowser.ObjectForScripting = new ScriptHelper(WebBrowser);
this.Content = WebBrowser ;
this.Style = Application.Current.MainWindow.FindResource("MainTabItemStyle") as Style;
WebBrowser.Navigate("about:blank");
var SID_SWebBrowserApp = new Guid("0002DF05-0000-0000-C000-000000000046");
var serviceProvider = (IServiceProvider)WebBrowser.Document;
var serviceGuid = SID_SWebBrowserApp;
var iid = typeof(SHDocVw.IWebBrowser2).GUID;
////Here we will get a reference to the IWebBrowser2 interface
ExBrowser = (SHDocVw.IWebBrowser2)serviceProvider.QueryService(ref serviceGuid, ref iid);
////To hook events we just need to do these casts
Events2 = (SHDocVw.DWebBrowserEvents_Event)ExBrowser;
Events = (SHDocVw.DWebBrowserEvents2_Event)ExBrowser;
System.Runtime.InteropServices.Marshal.ReleaseComObject((object)serviceProvider);
}
示例3: PhoneApplicationPage_Loaded
/// <summary>
/// Page_Loaded event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
WebBrowser webBrowser = new WebBrowser();
RowDefinition rdWebBrowser=new RowDefinition();
RowDefinition rdProgressBar = new RowDefinition();
rdProgressBar.Height = new GridLength(0.3, GridUnitType.Star);
rdWebBrowser.Height = new GridLength(13, GridUnitType.Star);
pgBar.Height = 10;
pgBar.IsIndeterminate = true;
pgBar.Visibility = Visibility.Visible;
webBrowser.Navigate(new Uri(RxConstants.myLocalPharmacySupport, UriKind.Absolute));
webBrowser.Navigated += new EventHandler<NavigationEventArgs>(NavigateHandler);
webBrowser.Visibility = Visibility.Visible;
webBrowser.Margin.Top.Equals(-12);
webBrowser.IsScriptEnabled = true;
ContentPanel.RowDefinitions.Insert(0, rdProgressBar);
ContentPanel.RowDefinitions.Insert(1, rdWebBrowser);
Grid.SetRow(pgBar, 0);
Grid.SetRow(webBrowser, 1);
ContentPanel.Children.Add(pgBar);
ContentPanel.Children.Add(webBrowser);
}
示例4: LoginAsync
private Task<LiveConnectSession> LoginAsync()
{
TaskCompletionSource<LiveConnectSession> taskCompletion = new TaskCompletionSource<LiveConnectSession>();
var url = _client.GetLoginUrl(new[] { "wl.basic", "wl.signin", "onedrive.readonly", "wl.skydrive", "wl.photos" });
WebBrowser browser = new WebBrowser();
var window = new Window();
window.Content = browser;
NavigatingCancelEventHandler handler = null;
handler = async (o, args) =>
{
if (args.Uri.AbsolutePath.Equals("/oauth20_desktop.srf"))
{
browser.Navigating -= handler;
window.Close();
var session = await GetConnectSession(args.Uri.Query);
taskCompletion.SetResult(session);
}
};
browser.Navigating += handler;
browser.Navigate(url);
window.Show();
return taskCompletion.Task;
}
示例5: WebViewBackend
internal WebViewBackend(SWC.WebBrowser browser)
{
view = browser;
view.Navigating += HandleNavigating;
view.Navigated += HandleNavigated;
view.LoadCompleted += HandleLoadCompleted;
view.Loaded += HandleViewLoaded;
Widget = view;
view.Navigate ("about:blank"); // force Document initialization
Title = string.Empty;
}
示例6: User
public User()
{
LogView = new WebBrowser();
LogView.Navigate(new Uri(AppResources.Server + "League.aspx"));
//LogView.Navigate(new Uri("/League.html", UriKind.Relative));
int loadbrowser = 0;
while (LogView.SaveToString().Length < 1) { loadbrowser++; }
string x = LogView.SaveToString();
MessageBox.Show("Done");
InitializeComponent();
}
示例7: PostToWall
//AAAIOfwttlbABADAgOfra14zhgQi2V82yNfuscJjLIwX0rT9nqRg4YYbmxZAZByKwq0lYWVvn9f1fIfEbY3i1wmQx2tZAOtpRxqGEDlE2phqiltqLw3X
//access token for me
public static void PostToWall(string message, long userId, string wallAccessToken, WebBrowser fBrowser)
{
var fb = new FacebookClient(wallAccessToken);
string url = string.Format("{0}/{1}", userId, "feed");
var argList = new Dictionary<string, object>();
argList["message"] = message;
fb.Post(url, argList);
var fb2 = new FacebookClient();
var logoutUrl = fb.GetLogoutUrl(new { access_token = wallAccessToken, next = "https://www.facebook.com/connect/login_success.html" });
fBrowser.Navigate(logoutUrl);
}
示例8: WebContent
public WebContent(RegionOptions options)
: base(options.Width, options.Height, options.Top, options.Left)
{
duration = options.Duration;
scheduleId = options.scheduleId;
layoutId = options.layoutId;
mediaId = options.mediaid;
type = options.FileType;
webBrowser = new WebBrowser();
webBrowser.Height = options.Height;
webBrowser.Width = options.Width;
//webBrowser.ScrollBarsEnabled = false;
//webBrowser.ScriptErrorsSuppressed = true;
// Attach event
webBrowser.LoadCompleted += (WebBrowserDocumentCompleted);
if (!Settings.Default.powerpointEnabled && options.FileType == "powerpoint")
{
webBrowser.Source = new Uri("<html><body><h1>Powerpoint not enabled on this display</h1></body></html>");
System.Diagnostics.Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", "Powerpoint is not enabled on this display", scheduleId, layoutId, mediaId));
}
else
{
try
{
// Try to make a URI out of the file path
try
{
this.filePath = Uri.UnescapeDataString(options.Uri);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message, "WebContent");
}
// Navigate
webBrowser.Navigate(this.filePath);
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", ex.Message, scheduleId, layoutId, mediaId));
webBrowser.Source = new Uri("<html><body><h1>Unable to show this web location - invalid address.</h1></body></html>");
System.Diagnostics.Trace.WriteLine(String.Format("[*]ScheduleID:{1},LayoutID:{2},MediaID:{3},Message:{0}", "Unable to show the powerpoint, cannot be located", scheduleId, layoutId, mediaId));
}
}
}
示例9: Map
public Map() {
/*var map = new StaticMap();
map.Center = "1000 7h Ave"; // or a lat/lng coordinate
map.Zoom = "14";
map.Size = "400x400";
map.Sensor = "true";
var uriMap = map.ToUri();
*/
Uri uriMap = new Uri("http://maps.google.com/");
wb = new WebBrowser();
Children.Add(wb);
wb.Navigate(uriMap);
}
示例10: LinkAsync
/// <summary>
/// Links a <see cref="ParseUser" /> to a Facebook account, allowing you to use Facebook
/// for authentication, and providing access to Facebook data for the user.
///
/// The user will be logged in through Facebook's OAuth web flow, so you must supply a
/// <paramref name="webView"/> that will be navigated to Facebook's authentication pages.
/// </summary>
/// <param name="user">The user to link with Facebook.</param>
/// <param name="webView">A web view that will be used to present the authorization pages
/// to the user.</param>
/// <param name="permissions">A list of Facebook permissions to request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
public static async Task LinkAsync(ParseUser user,
WebBrowser webView,
IEnumerable<string> permissions,
CancellationToken cancellationToken) {
authProvider.Permissions = permissions;
LoadCompletedEventHandler loadCompleted = (_, e) => authProvider.HandleNavigation(e.Uri);
webView.LoadCompleted += loadCompleted;
Action<Uri> navigate = uri => webView.Navigate(uri);
authProvider.Navigate += navigate;
await user.LinkWithAsync("facebook", cancellationToken);
authProvider.Navigate -= navigate;
webView.LoadCompleted -= loadCompleted;
}
示例11: LogInAsync
/// <summary>
/// Logs in a <see cref="ParseUser" /> using Facebook for authentication. If a user for the
/// given Facebook credentials does not already exist, a new user will be created.
///
/// The user will be logged in through Facebook's OAuth web flow, so you must supply a
/// <paramref name="webView"/> that will be navigated to Facebook's authentication pages.
/// </summary>
/// <param name="webView">A web view that will be used to present the authorization pages
/// to the user.</param>
/// <param name="permissions">A list of Facebook permissions to request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The user that was either logged in or created.</returns>
public static async Task<ParseUser> LogInAsync(WebBrowser webView,
IEnumerable<string> permissions,
CancellationToken cancellationToken) {
authProvider.Permissions = permissions;
LoadCompletedEventHandler loadCompleted = (_, e) => authProvider.HandleNavigation(e.Uri);
webView.LoadCompleted += loadCompleted;
Action<Uri> navigate = uri => webView.Navigate(uri);
authProvider.Navigate += navigate;
var result = await ParseUser.LogInWithAsync("facebook", cancellationToken);
authProvider.Navigate -= navigate;
webView.LoadCompleted -= loadCompleted;
return result;
}
示例12: Show
public void Show(string account, Uri authenticationUri, Uri redirectUri)
{
if (window == null) {
waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
var uiThread = new Thread(() => {
window = new Window() { Title = account };
window.Closing += (s, e) => {
window.Hide();
waitHandle.Set();
e.Cancel = true;
};
browser = new WebBrowser();
browser.Loaded += (s, e) => {
browser.Navigate(authenticationUri);
};
browser.Navigating += (s, e) => {
if (redirectUri.IsBaseOf(e.Uri) && redirectUri.AbsolutePath == e.Uri.AbsolutePath) {
var parameters = new NameValueCollection();
foreach (var parameter in e.Uri.Query.TrimStart('?').Split('&')) {
var nameValue = parameter.Split('=');
parameters.Add(nameValue[0], nameValue[1]);
}
var handler = Authenticated;
handler?.Invoke(this, new AuthenticatedEventArgs(parameters));
e.Cancel = true;
}
};
browser.Navigated += (s, e) => {
if (authenticationUri.IsBaseOf(e.Uri))
SetForegroundWindow(new WindowInteropHelper(window).Handle);
};
window.Content = browser;
window.Show();
System.Windows.Threading.Dispatcher.Run();
});
uiThread.SetApartmentState(ApartmentState.STA);
uiThread.Start();
} else {
window.Dispatcher.Invoke(() => {
browser.Source = authenticationUri;
window.Title = account;
window.Show();
});
}
waitHandle.WaitOne();
}
示例13: LoadWebBrowser
public void LoadWebBrowser(WebBrowser browser)
{
var authorizer = new OAuthAuthorizer(AppBootstrapper.ConsumerKey, AppBootstrapper.ConsumerSecret);
authorizer.GetRequestToken("https://api.twitter.com/oauth/request_token")
.Select(x => x.Token)
.DispatcherSubscribe(
token =>
{
_token = token;
string url = authorizer.BuildAuthorizeUrl("https://api.twitter.com/oauth/authorize", token);
browser.Navigate(new Uri(url));
},
OnError);
}
示例14: GoalB_Click
private void GoalB_Click(object sender, RoutedEventArgs e)
{
WebBrowser browser1 = new WebBrowser();
browser1.Navigate(new Uri(AppResources.Server + "Goal.aspx?teamScoring=" + "B" + "&MatchId=" + AppResources.GameId));
int loadbrowser = 0;
while (browser1.SaveToString().Length < 1) { loadbrowser++; }
string Data = browser1.SaveToString();
string[] RawHtmlSplit = Data.Split('`');
string DataNeeded = RawHtmlSplit[1];
if (DataNeeded.Contains("Score Updated"))
{
scoreB++;
ScoreB.Text = String.Format("{0}", scoreB);
}
else MessageBox.Show("Action Failed");
}
示例15: GetElement
public override FrameworkElement GetElement(string fileName)
{
var maxWidth = SystemParameters.WorkArea.Width - 100;
var maxHeight = SystemParameters.WorkArea.Height - 100;
var webBrowser = new WebBrowser();
webBrowser.BeginInit();
webBrowser.Width = maxWidth / 2;
webBrowser.Height = maxHeight / 2;
webBrowser.EndInit();
webBrowser.Navigate(new Uri(fileName, UriKind.Absolute));
return webBrowser;
}