-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
63 lines (60 loc) · 2.29 KB
/
Copy pathProgram.cs
File metadata and controls
63 lines (60 loc) · 2.29 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
using Avalonia;
using Avalonia.ReactiveUI;
using System;
using Velopack.Sources;
using Velopack;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Coravel;
namespace ModerBox {
internal sealed class Program {
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) {
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
VelopackApp.Build().Run();
Env.host = Host.CreateDefaultBuilder()
.ConfigureServices(service => {
service.AddSingleton(service);
service.AddScheduler();
})
.ConfigureLogging(logging => {
logging.ClearProviders();
logging.AddSimpleConsole(options => {
options.IncludeScopes = true;
options.SingleLine = true;
options.TimestampFormat = "[yyyy/MM/dd HH:mm:ss] ";
});
#if DEBUG
logging.AddDebug();
#endif
}).Build();
Env.host.Services.UseScheduler(scheduler => {
// Easy peasy 👇
scheduler
.ScheduleAsync(async () => {
try {
//await Util.UpdateMyApp();
} catch (Exception ex) {
Console.WriteLine(ex.ToString());
}
})
.EveryFiveMinutes().RunOnceAtStart();
});
Env.host.RunAsync();
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
}
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace()
.UseReactiveUI();
}
}