Продолжение рефакторинга (вынесение WPF в отдельный проект)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Pf2e.Scrapper.WPF.EntityViewer.Stores;
|
||||
using Pf2e.Scrapper.WPF.EntityViewer.ViewModel;
|
||||
|
||||
namespace Pf2e.WPF;
|
||||
|
||||
/// <summary>
|
||||
/// Расширение для IServiceCollection, позволяющее регистрировать сервисы WPF.
|
||||
/// </summary>
|
||||
public static class WpfServiceProviderExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Регистрация сервисов WPF в IServiceCollection.
|
||||
/// </summary>
|
||||
/// <param name="collection">Коллекция сервисов.</param>
|
||||
/// <returns>Коллекция сервисов (<paramref name="collection"/> для Fluent API).</returns>
|
||||
public static IServiceCollection RegisterWpfServices(this IServiceCollection collection)
|
||||
{
|
||||
return collection
|
||||
// ViewModels
|
||||
.AddTransient<EntityFormViewModel>()
|
||||
.AddTransient<EntityListViewModel>()
|
||||
.AddTransient<ViewViewModel>()
|
||||
// Stores
|
||||
.AddSingleton<SelectedEntityTypeStore>()
|
||||
.AddSingleton<SelectedEntityStore>()
|
||||
//
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user