private void Load(string cachePath, string currentDir)
        {
            try
            {
                CefRuntime.Load();
            }
            catch (DllNotFoundException ex)
            {
                ErrorAndExit(ex);
            }
            catch (CefRuntimeException ex)
            {
                ErrorAndExit(ex);
            }
            catch (Exception ex)
            {
                ErrorAndExit(ex);
            }

            var mainArgs = new CefMainArgs(new string[] { });
            var cefApp   = new AppDirectCefApp();

            var exitCode = CefRuntime.ExecuteProcess(mainArgs, cefApp);

            if (exitCode != -1)
            {
                ErrorAndExit(new Exception("CEF Failed to load"));
            }

            var cefSettings = new CefSettings
            {
                BrowserSubprocessPath    = currentDir + Path.DirectorySeparatorChar + CefClientExe,
                SingleProcess            = false,
                MultiThreadedMessageLoop = true,
                LogSeverity           = CefLogSeverity.Verbose,
                PersistSessionCookies = true,
                LogFile   = "cef.log",
                CachePath = cachePath,
                IgnoreCertificateErrors = true
            };

            try
            {
                CefRuntime.Initialize(mainArgs, cefSettings, cefApp);
            }
            catch (CefRuntimeException ex)
            {
                ErrorAndExit(ex);
            }
        }
Exemple #2
0
        private void Load(string cachePath, string currentDir)
        {
            try
            {
                CefRuntime.Load();
            }
            catch (DllNotFoundException ex)
            {
                ErrorAndExit(ex);
            }
            catch (CefRuntimeException ex)
            {
                ErrorAndExit(ex);
            }
            catch (Exception ex)
            {
                ErrorAndExit(ex);
            }

            var mainArgs = new CefMainArgs(new string[] { });
            var cefApp = new AppDirectCefApp();

            var exitCode = CefRuntime.ExecuteProcess(mainArgs, cefApp);
            if (exitCode != -1)
            {
                ErrorAndExit(new Exception("CEF Failed to load"));
            }

            var cefSettings = new CefSettings
            {
                BrowserSubprocessPath = currentDir + Path.DirectorySeparatorChar + CefClientExe,
                SingleProcess = false,
                MultiThreadedMessageLoop = true,
                LogSeverity = CefLogSeverity.Verbose,
                PersistSessionCookies = true,
                LogFile = "cef.log",
                CachePath = cachePath,
                IgnoreCertificateErrors = true
            };

            try
            {
                CefRuntime.Initialize(mainArgs, cefSettings, cefApp);
            }
            catch (CefRuntimeException ex)
            {
                ErrorAndExit(ex);
            }
        }