Beispiel #1
0
        private static void InitializeCef()
        {
            if (!Cef.IsInitialized)
            {
                var cefSettings = new CefSettings();
                cefSettings.LogSeverity = LogSeverity.Disable; // disable writing of debug.log
                cefSettings.UncaughtExceptionStackSize = 100;  // enable stack capture
                cefSettings.CachePath = TempDir;               // enable cache for external resources to speedup loading
                CefSharpSettings.LegacyJavascriptBindingEnabled = true;

                foreach (var scheme in CustomSchemes)
                {
                    cefSettings.RegisterScheme(new CefCustomScheme()
                    {
                        SchemeName           = scheme,
                        SchemeHandlerFactory = new CefSchemeHandlerFactory()
                    });
                }

                cefSettings.BrowserSubprocessPath = CefLoader.GetBrowserSubProcessPath();

                Cef.Initialize(cefSettings, performDependencyCheck: false, browserProcessHandler: null);

                if (Application.Current != null)
                {
                    Application.Current.Exit += OnApplicationExit;
                    subscribedApplicationExit = true;
                }
            }
        }
Beispiel #2
0
        private static void InitializeCef()
        {
            if (!Cef.IsInitialized)
            {
                var cefSettings = new CefSettings();
                cefSettings.LogSeverity = string.IsNullOrWhiteSpace(LogFile) ? LogSeverity.Disable : (EnableErrorLogOnly ? LogSeverity.Error : LogSeverity.Verbose);
                cefSettings.LogFile     = LogFile;
                cefSettings.UncaughtExceptionStackSize = 100; // enable stack capture
                cefSettings.CachePath = TempDir;              // enable cache for external resources to speedup loading
                cefSettings.WindowlessRenderingEnabled = true;

                CefSharpSettings.ConcurrentTaskExecution             = true;
                CefSharpSettings.LegacyJavascriptBindingEnabled      = true;
                CefSharpSettings.SubprocessExitIfParentProcessClosed = true;

                foreach (var scheme in CustomSchemes)
                {
                    cefSettings.RegisterScheme(new CefCustomScheme()
                    {
                        SchemeName           = scheme,
                        SchemeHandlerFactory = new CefSchemeHandlerFactory()
                    });
                }

                cefSettings.BrowserSubprocessPath = CefLoader.GetBrowserSubProcessPath();

                Cef.Initialize(cefSettings, performDependencyCheck: false, browserProcessHandler: null);

                if (Application.Current != null)
                {
                    Application.Current.Exit += OnApplicationExit;
                    subscribedApplicationExit = true;
                }
            }
        }
Beispiel #3
0
 private static void InitializeCef()
 {
     if (!Cef.IsInitialized)
     {
         CefSettings cefSettings = new CefSettings();
         cefSettings.LogSeverity = LogSeverity.Disable;
         cefSettings.UncaughtExceptionStackSize = 100;
         cefSettings.CachePath = WebView.TempDir;
         cefSettings.WindowlessRenderingEnabled               = true;
         CefSharpSettings.LegacyJavascriptBindingEnabled      = true;
         CefSharpSettings.SubprocessExitIfParentProcessClosed = true;
         foreach (string schemeName in WebView.CustomSchemes)
         {
             cefSettings.RegisterScheme(new CefCustomScheme
             {
                 SchemeName           = schemeName,
                 SchemeHandlerFactory = new CefSchemeHandlerFactory()
             });
         }
         cefSettings.BrowserSubprocessPath = CefLoader.GetBrowserSubProcessPath();
         Cef.Initialize(cefSettings, false, browserProcessHandler:  null);
         if (System.Windows.Application.Current != null)
         {
             System.Windows.Application.Current.Exit += WebView.OnApplicationExit;
             WebView.subscribedApplicationExit        = true;
         }
     }
 }