#785: Add a using to OffScreen.Example, now that Offscreen browser is a proper IDisposable.

This commit is contained in:
Bill Tutt
2015-02-03 20:01:00 -05:00
parent 329dad21c8
commit df03e82501
+16 -14
View File
@@ -29,22 +29,24 @@ namespace CefSharp.OffScreen.Example
CefExample.Init();
// Create the offscreen Chromium browser.
browser = new ChromiumWebBrowser(testUrl);
// An event that is fired when the first page is finished loading.
// This returns to us from another thread.
if (captureFirstRenderedImage)
using (browser = new ChromiumWebBrowser(testUrl))
{
browser.ResourceHandler.RegisterHandler(testUrl, ResourceHandler.FromString("<html><body><h1>CefSharp OffScreen</h1></body></html>"));
browser.ScreenshotAsync().ContinueWith(DisplayBitmap);
}
else
{
browser.FrameLoadEnd += BrowserFrameLoadEnd;
}
// We have to wait for something, otherwise the process will exit too soon.
Console.ReadKey();
// An event that is fired when the first page is finished loading.
// This returns to us from another thread.
if (captureFirstRenderedImage)
{
browser.ResourceHandler.RegisterHandler(testUrl, ResourceHandler.FromString("<html><body><h1>CefSharp OffScreen</h1></body></html>"));
browser.ScreenshotAsync().ContinueWith(DisplayBitmap);
}
else
{
browser.FrameLoadEnd += BrowserFrameLoadEnd;
}
// We have to wait for something, otherwise the process will exit too soon.
Console.ReadKey();
}
// Clean up Chromium objects. You need to call this in your application otherwise
// you will get a crash when closing.