-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
70 lines (59 loc) · 2.29 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using Chromely;
using Chromely.Core;
using Chromely.Core.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Text.Json;
namespace Test.Chromely
{
public class Program
{
[STAThread]
public static void Main(string[] args)
{
var config = DefaultConfiguration.CreateForRuntimePlatform();
config.CefDownloadOptions.AutoDownloadWhenMissing = false;
#if DEBUG
config.CefDownloadOptions.AutoDownloadWhenMissing = true;
#endif
config.StartUrl = "local://dist/index.html";
AppBuilder
.Create()
.UseConfig<DefaultConfiguration>(config)
.UseApp<AngularApp>()
.Build()
.Run(args);
}
}
public class AngularApp : ChromelyBasicApp
{
public override void ConfigureServices(IServiceCollection services)
{
base.ConfigureServices(services);
services.AddLogging(configure => configure.AddConsole());
services.AddLogging(configure => configure.AddFile("Logs/serilog-{Date}.txt"));
/*
// Optional - adding custom handler
services.AddSingleton<CefDragHandler, CustomDragHandler>();
*/
/*
// Optional- using config section to register IChromelyConfiguration
// This just shows how it can be used, developers can use custom classes to override this approach
//
var builder = new ConfigurationBuilder()
.SetBasePath(System.IO.Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json");
var configuration = builder.Build();
var config = DefaultConfiguration.CreateFromConfigSection(configuration);
services.AddSingleton<IChromelyConfiguration>(config);
*/
var options = new JsonSerializerOptions();
options.ReadCommentHandling = JsonCommentHandling.Skip;
options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
options.AllowTrailingCommas = true;
services.AddSingleton(options);
RegisterControllerAssembly(services, typeof(AngularApp).Assembly);
}
}
}