Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Configuration

mattkol edited this page Oct 8, 2017 · 39 revisions

Most required Cef configuration is done via ChromelyConfiguration class. ChromelyConfiguration provides default values that can be used as-is or set new properties.

The followings are configured:

CefAppArgs  - Cef app arguments
CefStartUrl - Cef start url
CefHostWidth - Cef start width
CefHostHeight -  Cef start height
CefLogSeverity - Cef log severity
CefLogFile - Cef log file

Use default logger or set a new one
Use default IOC container or set a new one
Registration of custom url schemes
Registration of external url schemes
Registration of custom scheme handlers
Registration of custom Javascript objects

ChromelyConfiguration is fluently set. Sample Configuration:

ChromelyConfiguration config = ChromelyConfiguration
                              .Create()
                              .WithCefAppArgs(args)
                              .WithCefHostSize(1200, 900)
                              .WithCefLogFile("logs\\chromely.cef_new.log")
                              .WithCefStartUrl(startUrl)
                              .WithCefLogSeverity(LogSeverity.Info)
                              .UseDefaultLogger("logs\\chromely_new.log", true)
                              .RegisterSchemeHandler("http", "chromely.com", new CefGlueSchemeHandlerFactory());

A new IOC container (of type IChromelyContainer)can be set prior to setting the configuration object or set passing via constructor (create). *** This must be done prior to other registrations otherwise the default container will kick in during these registrations and will be lost (invalid). ONLY one IOC container is required.

// The IOC container must implement the IChromelyContainer interface.
IChromelyContainer newContainer = new CustomContainer();
IoC.Container = newContainer;

Or:

// The IOC container must implement the IChromelyContainer interface.
IChromelyContainer newContainer = new CustomContainer();
ChromelyConfiguration config = ChromelyConfiguration()
                              .Create(newContainer)
                              .WithCefAppArgs(args)
                              .WithCefHostSize(1200, 900)
                              .WithCefLogFile("logs\\chromely.cef_new.log")
                              .WithCefStartUrl(startUrl)
                              .WithCefLogSeverity(LogSeverity.Info)
                              .UseDefaultLogger("logs\\chromely_new.log", true)
                              .RegisterSchemeHandler("http", "chromely.com", new CefGlueSchemeHandlerFactory());