-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (42 loc) · 1.46 KB
/
Copy pathProgram.cs
File metadata and controls
46 lines (42 loc) · 1.46 KB
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
using Photino.NET;
using AvifGenerator.Models;
using AvifGenerator.Services;
using AvifGenerator.Utils;
using Microsoft.Extensions.DependencyInjection;
namespace AvifGenerator;
class Program
{
[STAThread]
static int Main()
{
string baseDir = Helpers.GetProjectRoot();
string indexPath = Path.Combine(baseDir, "wwwroot", "index.html");
var services = new ServiceCollection();
services.AddSingleton<GenerationOptions>(new GenerationOptions
{
BaseDir = baseDir,
ReportPath = Path.Combine(baseDir, "report.txt")
});
services.AddSingleton<GenerationDataContext>();
services.AddSingleton<Bridge>();
services.AddSingleton<Executor>();
services.AddTransient<SkiaImageBuilder>();
services.AddSingleton<PhotinoWindow>(sp =>
{
var bridge = sp.GetRequiredService<Bridge>();
var window = new PhotinoWindow()
.SetTitle("AVIF Generator - Visual Editor")
.SetUseOsDefaultSize(false)
.SetSize(1024, 768)
.Center()
.Load(indexPath)
.RegisterWebMessageReceivedHandler(bridge.HandleMessage);
bridge.Window = window;
return window;
});
var serviceProvider = services.BuildServiceProvider();
var window = serviceProvider.GetRequiredService<PhotinoWindow>();
window.WaitForClose();
return 0;
}
}