diff --git a/CefSharp.MinimalExample.WinForms/BrowserForm.cs b/CefSharp.MinimalExample.WinForms/BrowserForm.cs index e291a94..b4b1b01 100644 --- a/CefSharp.MinimalExample.WinForms/BrowserForm.cs +++ b/CefSharp.MinimalExample.WinForms/BrowserForm.cs @@ -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));