registrated new services in DI container
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using CursorLang.Models;
|
|
||||||
using CursorLang.Services;
|
using CursorLang.Services;
|
||||||
using CursorLang.ViewModels;
|
using CursorLang.ViewModels;
|
||||||
using CursorLang.Views;
|
using CursorLang.Views;
|
||||||
@@ -7,9 +6,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
|
|
||||||
namespace CursorLang;
|
namespace CursorLang;
|
||||||
|
|
||||||
/// <summary>
|
// ReSharper disable once RedundantExtendsListEntry
|
||||||
/// Композиционный корень: собирает контейнер и запускает окно настроек.
|
|
||||||
/// </summary>
|
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
private ServiceProvider? _services;
|
private ServiceProvider? _services;
|
||||||
@@ -41,6 +38,8 @@ public partial class App : Application
|
|||||||
MainWindow = _services.GetRequiredService<MainWindow>();
|
MainWindow = _services.GetRequiredService<MainWindow>();
|
||||||
MainWindow.Show();
|
MainWindow.Show();
|
||||||
|
|
||||||
|
_ = _services.GetRequiredService<SettingsViewModel>().InitializeAsync();
|
||||||
|
_ = _services.GetRequiredService<UpdateViewModel>().StartAsync();
|
||||||
_services.GetRequiredService<LayoutNotificationCoordinator>().Start();
|
_services.GetRequiredService<LayoutNotificationCoordinator>().Start();
|
||||||
_services.GetRequiredService<CapsLockSwitchCoordinator>().Start();
|
_services.GetRequiredService<CapsLockSwitchCoordinator>().Start();
|
||||||
}
|
}
|
||||||
@@ -75,9 +74,10 @@ public partial class App : Application
|
|||||||
MainWindow.Activate();
|
MainWindow.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConfigureServices(IServiceCollection services)
|
internal static void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddSingleton(new KeyboardLayoutOptions());
|
services.AddSingleton(new KeyboardLayoutOptions());
|
||||||
|
services.AddSingleton(new UpdateOptions());
|
||||||
|
|
||||||
services.AddSingleton<SettingsService>();
|
services.AddSingleton<SettingsService>();
|
||||||
services.AddSingleton(provider => provider.GetRequiredService<SettingsService>().Load());
|
services.AddSingleton(provider => provider.GetRequiredService<SettingsService>().Load());
|
||||||
@@ -88,6 +88,8 @@ public partial class App : Application
|
|||||||
services.AddSingleton<MainWindowPlacement>();
|
services.AddSingleton<MainWindowPlacement>();
|
||||||
|
|
||||||
services.AddSingleton<ILocalizationService, LocalizationService>();
|
services.AddSingleton<ILocalizationService, LocalizationService>();
|
||||||
|
services.AddSingleton<IStartupService, StartupService>();
|
||||||
|
services.AddSingleton<IUpdateService, UpdateService>();
|
||||||
services.AddSingleton<IKeyboardLayoutService, KeyboardLayoutService>();
|
services.AddSingleton<IKeyboardLayoutService, KeyboardLayoutService>();
|
||||||
services.AddSingleton<ILayoutPopupService, LayoutPopupService>();
|
services.AddSingleton<ILayoutPopupService, LayoutPopupService>();
|
||||||
services.AddSingleton<ICapsLockHotkeyService, CapsLockHotkeyService>();
|
services.AddSingleton<ICapsLockHotkeyService, CapsLockHotkeyService>();
|
||||||
@@ -95,9 +97,11 @@ public partial class App : Application
|
|||||||
services.AddSingleton<CapsLockSwitchCoordinator>();
|
services.AddSingleton<CapsLockSwitchCoordinator>();
|
||||||
|
|
||||||
services.AddSingleton<LayoutPopupViewModel>();
|
services.AddSingleton<LayoutPopupViewModel>();
|
||||||
|
services.AddSingleton<UpdateViewModel>();
|
||||||
services.AddSingleton<SettingsViewModel>();
|
services.AddSingleton<SettingsViewModel>();
|
||||||
|
|
||||||
services.AddSingleton<LayoutPopupWindow>();
|
services.AddSingleton<LayoutPopupWindow>();
|
||||||
|
services.AddSingleton<ILayoutPopupWindow>(provider => provider.GetRequiredService<LayoutPopupWindow>());
|
||||||
services.AddSingleton<MainWindow>();
|
services.AddSingleton<MainWindow>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user