本文整理汇总了C#中IWebBrowser.LoadUrl方法的典型用法代码示例。如果您正苦于以下问题:C# IWebBrowser.LoadUrl方法的具体用法?C# IWebBrowser.LoadUrl怎么用?C# IWebBrowser.LoadUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWebBrowser
的用法示例。
在下文中一共展示了IWebBrowser.LoadUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WebReferenceDialog
// protected Gtk.Alignment frmBrowserAlign;
#endregion
/// <summary>Initializes a new instance of the AddWebReferenceDialog widget.</summary>
public WebReferenceDialog (DotNetProject project)
{
Build();
this.basePath = Library.GetWebReferencePath (project);
this.IsWebService = false;
this.project = project;
// Add the mozilla control to the frame
if (WebBrowserService.CanGetWebBrowser) {
browser = WebBrowserService.GetWebBrowser ();
browserWidget = (Widget) browser;
browser.LocationChanged += Browser_LocationChanged;
browser.NetStart += Browser_StartLoading;
browser.NetStop += Browser_StopLoading;
frmBrowser.Add(browserWidget);
browser.LoadUrl(this.homeUrl);
browserWidget.Show();
} else {
tlbNavigate.Visible = false;
ScrolledWindow sw = new ScrolledWindow ();
sw.ShadowType = ShadowType.In;
docLabel = new Label ();
docLabel.Xpad = 6;
docLabel.Ypad = 6;
docLabel.Xalign = 0;
docLabel.Yalign = 0;
sw.AddWithViewport (docLabel);
sw.ShowAll ();
frmBrowser.Add (sw);
tbxReferenceURL.Text = homeUrl;
UpdateLocation ();
}
frmBrowser.Show();
this.Child.ShowAll ();
}
示例2: ChangeState
void ChangeState (DialogState newState)
{
bool hasConfig = comboModel.Active == 0;
switch (newState) {
case DialogState.Create:
btnBack.Visible = false;
btnConfig.Visible = true;
btnConfig.Sensitive = isWebService && hasConfig;
btnOK.Visible = true;
btnOK.Sensitive = isWebService;
tlbNavigate.Visible = WebBrowserService.CanGetWebBrowser;
tbxReferenceName.Sensitive = isWebService;
comboModel.Sensitive = true;
break;
case DialogState.CreateConfig:
btnBack.Visible = true;
btnBack.Sensitive = true;
btnConfig.Visible = false;
btnOK.Visible = true;
btnOK.Sensitive = true;
tlbNavigate.Visible = false;
tbxReferenceName.Sensitive = false;
comboModel.Sensitive = false;
break;
case DialogState.Modify:
btnBack.Visible = false;
btnConfig.Visible = true;
btnConfig.Sensitive = isWebService && hasConfig;
btnOK.Visible = true;
btnOK.Sensitive = isWebService;
tlbNavigate.Visible = WebBrowserService.CanGetWebBrowser;
tbxReferenceName.Sensitive = false;
comboModel.Sensitive = false;
break;
case DialogState.ModifyConfig:
btnBack.Visible = false;
btnConfig.Visible = false;
btnOK.Visible = true;
btnOK.Sensitive = true;
tlbNavigate.Visible = false;
tbxReferenceName.Sensitive = false;
comboModel.Sensitive = false;
break;
default:
throw new InvalidOperationException ();
}
if (wcfConfig != null)
wcfConfig.Update ();
if (state == newState)
return;
if (state != DialogState.Uninitialized)
frmBrowser.Forall (c => frmBrowser.Remove (c));
browser = null;
browserWidget = null;
docLabel = null;
wcfConfig = null;
state = newState;
ScrolledWindow sw;
switch (state) {
case DialogState.Create:
case DialogState.Modify:
if (WebBrowserService.CanGetWebBrowser) {
browser = WebBrowserService.GetWebBrowser ();
browserWidget = (Widget) browser;
browser.LocationChanged += Browser_LocationChanged;
browser.NetStart += Browser_StartLoading;
browser.NetStop += Browser_StopLoading;
frmBrowser.Add (browserWidget);
browser.LoadUrl (tbxReferenceURL.Text);
browserWidget.Show ();
} else {
docLabel = new Label ();
docLabel.Xpad = 6;
docLabel.Ypad = 6;
docLabel.Xalign = 0;
docLabel.Yalign = 0;
sw = new ScrolledWindow ();
sw.ShadowType = ShadowType.In;
sw.AddWithViewport (docLabel);
sw.ShowAll ();
frmBrowser.Add (sw);
UpdateLocation ();
}
break;
case DialogState.ModifyConfig:
case DialogState.CreateConfig:
//.........这里部分代码省略.........
示例3: Open
public bool Open(string address)
{
if ( PropertyService.Get<bool>("Unity.Base.Documentation.OpenInBrowser", true))
{
// TODO: Change back to using DesktopService.ShowUrl(address)
// PlatformService was replaced with DesktopService
// Windows MonoDevelop is not updated with this change yet.
System.Diagnostics.Process.Start(address);
return true;
}
else
{
if (MonoDevelop.Core.Gui.WebBrowserService.CanGetWebBrowser)
{
browser = WebBrowserService.GetWebBrowser();
browser.LoadUrl(address);
return true;
}
else
{
MessageService.ShowMessage(GettextCatalog.GetString("Missing Extension"),
GettextCatalog.GetString("The Mono.WebBrowser Extension (part of Mono) is required for this functionality to work. We'll set your \"Open In Browser\" setting back to open with your default browser."));
PropertyService.Set("Unity.Base.Documentation.OpenInBrowser", true);
return false;
}
}
}