Am using Cefsharp 39.0.0 to load a webpage inside a winform. Now while the page loads the form is blank. How do I show a loading gif?
public Browser() {
InitializeComponent();
string clientURL = "www.imdb.com";
ChromiumWebBrowser browser = new ChromiumWebBrowser(clientURL);
browser.Dock = DockStyle.Fill;
toolStripContainer.ContentPanel.Controls.Add(browser);
browser.RegisterJsObject("camera", new Camera());
}
I looked into NavStateChanged event. but am not sure how to go about using it to display a loading image from local resoruce in the form until the webpage loads fully.
EventHandler < NavStateChangedEventArgs > handler = null;
handler = (sender, args) = > {
//TODO : show a loading gif until the page load completes
//Wait for while page to finish loading not just the first frame
if (!args.IsLoading) {
browser.NavStateChanged -= handler;
MessageBox.Show("The page has completed loading", "Load completed", MessageBoxButtons.OK);
//TODO : once load complete show the actual page
}
};