internal RuntimeBuilder(Action <ChromiumEnvironmentBuilder> buildChromiumEnvironment = null, Action <ApplicationConfigurationBuilder> configureAppConfiguration = null) { _context = new RuntimeBuilderContext(Properties); _options = new RuntimeOptions(_context); _context.Properties[typeof(SimpleContainer)] = _container = new SimpleContainer(); var hostExtension = new HostWindow.JavaScriptExtension.HostWindowExtension(); _container.RegisterInstance <JavaScriptExtensionBase>(hostExtension, hostExtension.Name); _context.Properties[typeof(ChromiumEnvironmentBuilder)] = _chromiumEnvironmentBuilder = new ChromiumEnvironmentBuilder(_context); buildChromiumEnvironment?.Invoke(_chromiumEnvironmentBuilder); _context.Properties[typeof(ChromiumEnvironment)] = _env = _chromiumEnvironmentBuilder.Build(); _context.Properties[typeof(ApplicationConfigurationBuilder)] = _appConfigBuilder = new ApplicationConfigurationBuilder(_context); configureAppConfiguration?.Invoke(_appConfigBuilder); _context.Properties[typeof(ApplicationConfiguration)] = _appConfig = _appConfigBuilder.Build(); }
internal ChromiumEnvironment Build() { var env = new ChromiumEnvironment(); if (_cefBinaryFilePaths == null) { AutoDetectCefBinaryPath(); } if (string.IsNullOrEmpty(_libCefDir) || string.IsNullOrEmpty(_resourceDir)) { foreach (var handle in _ifLibCefNotFound) { var path = handle?.Invoke(WinFormium.PlatformArchitecture); _libCefDir = CheckLibCefPath(path); _resourceDir = CheckLibCefResourceFilesPath(path); if (!string.IsNullOrEmpty(_libCefDir) && !string.IsNullOrEmpty(_resourceDir)) { break; } } if (string.IsNullOrEmpty(_libCefDir) || string.IsNullOrEmpty(_resourceDir)) { throw new DirectoryNotFoundException("The CEF binary files are not found."); } } env.LibCefDir = _libCefDir; env.LibCefResourceDir = _resourceDir; env.LibCefLocaleDir = Path.Combine(_resourceDir, LOCALES_DIR); if (_externalSubprocessConfiguration != null) { if (!File.Exists(_externalSubprocessConfiguration.SubprocessPath)) { throw new FileNotFoundException($"Can't find the path {_externalSubprocessConfiguration.SubprocessPath}."); } else { env.SubprocessPath = _externalSubprocessConfiguration.SubprocessPath; } } env.CommandLineConfigurations = _cefCommandLineConfigurations; env.SettingConfigurations = _cefSettingConfigurations; env.CefBrowserSettingConfigurations = _cefCefBrowserSettingConfigurations; env.ForceHighDpiSupportDisabled = _forceHighDpiSupportDisabled; return(env); }