33 lines
1.2 KiB
C#
33 lines
1.2 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using Pf2e.Scrapper.WPF.EntityViewer.Stores;
|
|
using Pf2e.Scrapper.WPF.EntityViewer.ViewModel;
|
|
using Pf2e.WPF.EntityViewer.Stores;
|
|
using Pf2e.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>()
|
|
//
|
|
;
|
|
}
|
|
}
|