Add CefSharpSettings.ShutdownOnExit - all the user to disable the inbuilt call to Cef.Shutdown

(Also needs to set shutdownOnProcessExit:false when calling Cef.Initialize, or the ParentProcessExitHandler will be called to Shutdown Cef)
This commit is contained in:
amaitland
2015-10-08 22:37:14 +10:00
parent ac4df2e7c5
commit efb841fdca
3 changed files with 27 additions and 5 deletions
+4 -1
View File
@@ -68,7 +68,10 @@ namespace CefSharp.WinForms
static ChromiumWebBrowser()
{
Application.ApplicationExit += OnApplicationExit;
if (CefSharpSettings.ShutdownOnExit)
{
Application.ApplicationExit += OnApplicationExit;
}
}
private static void OnApplicationExit(object sender, EventArgs e)
+7 -4
View File
@@ -84,11 +84,14 @@ namespace CefSharp.Wpf
static ChromiumWebBrowser()
{
var app = Application.Current;
if (app != null)
if (CefSharpSettings.ShutdownOnExit)
{
app.Exit += OnApplicationExit;
var app = Application.Current;
if (app != null)
{
app.Exit += OnApplicationExit;
}
}
}
+16
View File
@@ -6,11 +6,27 @@ namespace CefSharp
{
public static class CefSharpSettings
{
/// <summary>
/// Set default values for CefSharpSettings
/// </summary>
static CefSharpSettings()
{
ShutdownOnExit = true;
}
/// <summary>
/// WCF is used by JavascriptBinding
/// Disabling effectively disables both of these features.
/// Defaults to true
/// </summary>
public static bool WcfEnabled { get; set; }
/// <summary>
/// For the WinForms and WPF instances of ChromiumWebBrowser the relevant Application Exit event
/// is hooked and Cef.Shutdown() called by default. Set this to false to disable this behaviour.
/// This value needs to be set before the first instance of ChromiumWebBrowser is created as
/// the event handlers are hooked in the static constructor for the ChromiumWebBrowser class
/// </summary>
public static bool ShutdownOnExit { get; set; }
}
}