WinForms Example - Load Url after browser initialized
Temp workaround for a bug where the address passed into the constructor isn't always loading
This commit is contained in:
parent
c062e8be43
commit
562bfee7c6
@ -20,7 +20,7 @@ namespace CefSharp.MinimalExample.WinForms
|
||||
Text = "CefSharp";
|
||||
WindowState = FormWindowState.Maximized;
|
||||
|
||||
browser = new ChromiumWebBrowser("www.google.com")
|
||||
browser = new ChromiumWebBrowser()
|
||||
{
|
||||
Dock = DockStyle.Fill,
|
||||
};
|
||||
@ -31,12 +31,21 @@ namespace CefSharp.MinimalExample.WinForms
|
||||
browser.StatusMessage += OnBrowserStatusMessage;
|
||||
browser.TitleChanged += OnBrowserTitleChanged;
|
||||
browser.AddressChanged += OnBrowserAddressChanged;
|
||||
browser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged;
|
||||
|
||||
var bitness = Environment.Is64BitProcess ? "x64" : "x86";
|
||||
var version = String.Format("Chromium: {0}, CEF: {1}, CefSharp: {2}, Environment: {3}", Cef.ChromiumVersion, Cef.CefVersion, Cef.CefSharpVersion, bitness);
|
||||
DisplayOutput(version);
|
||||
}
|
||||
|
||||
private void OnIsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e)
|
||||
{
|
||||
if(e.IsBrowserInitialized)
|
||||
{
|
||||
browser.Load("www.google.com");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBrowserConsoleMessage(object sender, ConsoleMessageEventArgs args)
|
||||
{
|
||||
DisplayOutput(string.Format("Line: {0}, Source: {1}, Message: {2}", args.Line, args.Source, args.Message));
|
||||
|
Loading…
Reference in New Issue
Block a user