|
| 1 | +using Hypermc.Settings; |
| 2 | +using Hypermc.UI.Views; |
1 | 3 | using Microsoft.Extensions.DependencyInjection; |
2 | 4 | using System; |
3 | 5 | using System.Collections.Generic; |
|
7 | 9 |
|
8 | 10 | namespace Hypermc |
9 | 11 | { |
10 | | - static class Program |
11 | | - { |
12 | | - private static IServiceProvider Provider; |
13 | | - /// <summary> |
14 | | - /// The main entry point for the application. |
15 | | - /// </summary> |
16 | | - [STAThread] |
17 | | - static void Main() |
18 | | - { |
19 | | - Provider = ConfigureService(); |
| 12 | + static class Program |
| 13 | + { |
| 14 | + private static IServiceProvider Provider; |
| 15 | + /// <summary> |
| 16 | + /// The main entry point for the application. |
| 17 | + /// </summary> |
| 18 | + [STAThread] |
| 19 | + static void Main() |
| 20 | + { |
| 21 | + Provider = ConfigureService(); |
| 22 | + Provider.GetRequiredService<IUserSettings>().Initialize(); |
20 | 23 |
|
21 | | - Application.SetHighDpiMode(HighDpiMode.SystemAware); |
22 | | - Application.EnableVisualStyles(); |
23 | | - Application.SetCompatibleTextRenderingDefault(false); |
24 | | - Application.Run(Provider.GetRequiredService<HyperMcView>()); |
25 | | - } |
| 24 | + Application.SetHighDpiMode(HighDpiMode.SystemAware); |
| 25 | + Application.EnableVisualStyles(); |
| 26 | + Application.SetCompatibleTextRenderingDefault(false); |
| 27 | + Application.Run(Provider.GetRequiredService<HyperMcView>()); |
| 28 | + } |
26 | 29 |
|
27 | | - private static IServiceProvider ConfigureService() |
28 | | - { |
29 | | - IServiceCollection services = new ServiceCollection(); |
| 30 | + private static IServiceProvider ConfigureService() |
| 31 | + { |
| 32 | + IServiceCollection services = new ServiceCollection(); |
30 | 33 |
|
31 | | - services.AddSingleton<HyperMcView>(); |
32 | | - services.AddForgeClient(); |
| 34 | + services.AddSingleton<HyperMcView>() |
| 35 | + .AddSingleton<IUserSettings, UserSettings>(); |
33 | 36 |
|
34 | | - return services.BuildServiceProvider(); |
35 | | - } |
36 | | - } |
| 37 | + services.AddTransient<SettingView>(); |
| 38 | + |
| 39 | + services.AddForgeClient(); |
| 40 | + |
| 41 | + return services.BuildServiceProvider(); |
| 42 | + } |
| 43 | + } |
37 | 44 | } |
0 commit comments