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

Latest commit

 

History

History
166 lines (132 loc) · 5.74 KB

configuration.md

File metadata and controls

166 lines (132 loc) · 5.74 KB

Chromely Configuration

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.

The default implementation of IChromelyConfiguration has the following features:

  • Property - AppName

    • Current application name
  • Property - StartUrl

  • Property - ChromelyVersion

    • Usually ReadOnly Chromely/CEF version
  • Property - Platform

  • 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

  • List of objects - UrlSchemes

  • Object - CefDownloadOptions

  • Object - WindowOptions

  • Object - WindowOptions

  • 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
{
}