-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
71 lines (62 loc) · 2.08 KB
/
Program.cs
File metadata and controls
71 lines (62 loc) · 2.08 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// BlazorGirCore
using System.Runtime.Versioning;
using BlazorShared.Layout;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using WebKit.BlazorWebView.GirCore;
using Yaml.Localization;
[UnsupportedOSPlatform("OSX")]
[UnsupportedOSPlatform("Windows")]
internal class Program
{
internal const string ApplicationId = "gir.core.blazorsample";
internal const string ApplicationVersion = "1.0.0.0";
private static void Main(string[] _)
{
foreach (var resource in typeof(BlazorShared.Lang).Assembly.GetManifestResourceNames())
{
Console.WriteLine(resource);
}
Adw.Module.Initialize();
Gtk.Module.Initialize();
WebKit.Module.Initialize();
var services = new ServiceCollection()
.AddLogging(config =>
{
config.AddSimpleConsole(options =>
{
options.ColorBehavior = Microsoft.Extensions.Logging.Console.LoggerColorBehavior.Enabled;
options.SingleLine = true;
options.TimestampFormat = "HH:mm:ss ";
}).SetMinimumLevel(LogLevel.Information);
});
services
.AddSingleton<IPlatformService, GirCorePlatformService>()
.AddSingleton<ChangeThemeStore>()
.AddSingleton<CultureSelectorStore>()
.AddYamlEmbeddedResourceLocalization(typeof(BlazorShared.Lang).Assembly)
.AddBlazorWebView(
new BlazorWebViewOptions()
{
RootComponent = typeof(BlazorGirCore.Components.App),
HostPath = "wwwroot/index.html"
});
var provider = services.BuildServiceProvider();
var application = Adw.Application.New(ApplicationId, Gio.ApplicationFlags.FlagsNone);
application.OnActivate += (sender, args) =>
{
var window = Gtk.ApplicationWindow.New((Adw.Application)sender);
window.Title = "Blazor GirCore";
window.SetDefaultSize(800, 600);
var webView = new BlazorWebView(provider);
window.SetChild(webView);
window.Show();
// Allow opening developer tools
webView.GetSettings().EnableDeveloperExtras = true;
};
application.OnShutdown += (sender, args) =>
{
};
application.RunWithSynchronizationContext([]);
}
}