private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (!browserView.IsDisposed) { browserView.Browser.Dispose(); browserView.Dispose(); } }
private void AboutDemo() { Window aboutDemo = new Window(); String strVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); BrowserView browserViewDemo = new WPFBrowserView(BrowserFactory.Create(BrowserType.HEAVYWEIGHT)); aboutDemo.Width = 380; aboutDemo.Height = 300; aboutDemo.Title = "About Demo"; aboutDemo.ResizeMode = ResizeMode.NoResize; aboutDemo.WindowStyle = WindowStyle.SingleBorderWindow; aboutDemo.Topmost = true; aboutDemo.Content = browserViewDemo; string textAboutDemo = "<br>" + "<html><font face='Arial' size='2'>" + "<font size='5'>DotNetBrowser Demo</font><br><br>" + "<b>Version " + strVersion + "</b><br><br>" + "<base target='_blank'>" + "This application is created for demonstration purposes only.<br>" + "© 2017 TeamDev Ltd. All rights reserved.<br><br>" + "Powered by <a color='#3d82f8' href='https://www.teamdev.com/dotnetbrowser' " + "style='text-decoration:none'>DotNetBrowser</a>. See " + "<a color='#3d82f8' href='https://www.teamdev.com/dotnetbrowser-licence-agreement' " + "style='text-decoration:none'>terms of use.</a><br>" + "Based on <a color='#3d82f8' href='http://www.chromium.org/' " + "style='text-decoration:none'>Chromium project</a>. " + "See <a color='#3d82f8' " + "href='http://dotnetbrowser-support.teamdev.com/documentation/open-source-components-licences' " + "style='text-decoration:none'>full list</a> of Chromium<br>components, " + "used in the current DotNetBrowser version.<br><br>" + "This demo uses WebKit project under LGPL.<br>" + "See licence text " + "<a color='#3d82f8' href='https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html' " + "style='text-decoration:none'>LGPL v.2</a> and " + "<a color='#3d82f8' href='https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html' " + "style='text-decoration:none'>LGPL v.2.1</a></font></html>"; browserViewDemo.Browser.LoadHTML(textAboutDemo); aboutDemo.Owner = Window.GetWindow((FrameworkElement)browserView); aboutDemo.WindowStartupLocation = WindowStartupLocation.CenterOwner; aboutDemo.Closing += delegate { if (!browserViewDemo.Browser.IsDisposed()) { browserViewDemo.Browser.Dispose(); browserViewDemo.Dispose(); } }; aboutDemo.ShowDialog(); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { // Dispose BrowserView when close app window. browserView.Dispose(); browser.Dispose(); }