Chromely configuration is equivalent to Desktop App.config or Web project Web.config/appsettings.config. Most required CEF/Chromely configurations are done via IChromelyConfiguration implementation. Configuration provides default values that can be used as-is or with new/custom properties set.
To create Chromely application, the Configuration class is not required. A custom configuration class must implement - IChromelyConfiguration.
- If no configuraton file is found, it uses the default - DefaultConfiguration.
The default implementation of IChromelyConfiguration has the following features:
-
Property - AppName
- Current application name
-
Property - StartUrl
- The start url
- For more info, please see Loading Html.
-
Property - ChromelyVersion
- Usually ReadOnly Chromely/CEF version
-
Property - Platform
- The platform/OS type - ChromelyPlatform.
-
Property - DebuggingMode
- Debugging mode - true/false
-
List - CommandLineArgs
- Usually CEF command line arguments, but can be used for anything.
- Can be set in both config file or C# code
- Configuration:
-
"customSettings": [ { "name": "cefLogFile", "value": "logs\\chromely.cef.log" }
-
var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CustomSettings = new Dictionary<string, string>() { ["cefLogFile"] = "logs\\chromely.cef.log", ["logSeverity"] = "info", ["locale"] = "en-US" };
-
-
List - CommandLineOptions
- Usually CEF command line options, but can be used for anything.
- Can be set in both config file or C# code
- Configuration:
-
"commandLineOptions": [ "no-zygote", "disable-gpu" ]
-
var config = DefaultConfiguration.CreateForRuntimePlatform(); config.CommandLineOptions = new List<string>() { "no-zygote", "disable-gpu" };
-
-
Dictionary - CustomSettings
- Usually CEF settings options, but can be used for anything.
- Can be set in both config file or C# code
- Configuration:
-
"customSettings": [ { "name": "cefLogFile", "value": "logs\\chromely.cef.log" }, { "name": "logSeverity", "value": "info" }, { "name": "locale", "value": "en-US" } ]
-
var config = DefaultConfiguration.CreateForRuntimePlatform(); config. CustomSettings = new Dictionary<string, string>() { ["cefLogFile"] = "logs\\chromely.cef.log", ["logSeverity"] = "info", ["locale"] = "en-US" };
-
-
Interface/object - IChromelyJavaScriptExecutor
- For more info, please see JavaScript Execution
-
List of objects - UrlSchemes
- For more info, please see Registering Url Schemes
-
Object - CefDownloadOptions
- For more info, please see CefDownloadOptions
-
Object - WindowOptions
- For more info, please see WindowOptions
-
Object - WindowOptions
- For more info, please see IWindowOptions
-
Object - ExtensionData
- System.Text.Json provides extra storage facility via ExtensionData
- This is implemented as-is provided by System.Text.Json.
var config = DefaultConfiguration.CreateForRuntimePlatform();
ThreadApt.STA();
AppBuilder
.Create(args)
.UseConfig<DefaultConfiguration>()
.UseApp<CustomChromelyApp>(config)
.Build()
.Run();
Or:
ThreadApt.STA();
AppBuilder
.Create(args)
.UseConfig<CustomConfiguraton>()
.UseApp<CustomChromelyApp>(new CustomChromelyApp())
.Build()
.Run();
public class Customfiguraton: ICCustomConfiguraton
{
}
Or:
ThreadApt.STA();
AppBuilder
.Create(args)
.UseConfig<CustomConfiguraton>(new Customfiguraton())
.UseApp<CustomChromelyApp>(new CustomChromelyApp())
.Build()
.Run();
public class Customfiguraton: ICCustomConfiguraton
{
}