/
n1kolas
/
NoteCreator
Обзор
Документация
Войти
/
n1kolas
/
NoteCreator
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
App.xaml.cs
42 строки
1 KB
Nicolai
Added core functionality to program
05 окт 2025, 22:32
05 окт 2025, 22:32
48a91e7
Код
Авторство
О чём код?
using LogIn.Services; using LogIn.UI.Windows; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.ServiceProcess; using System.Threading.Tasks; using System.Windows; namespace LogIn { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application { public static IServiceProvider? ServiceProvider { get; private set; } public App() { var services = new ServiceCollection(); ConfigureServices(services); ServiceProvider = services.BuildServiceProvider(); } private void ConfigureServices(IServiceCollection services) { services.AddSingleton<IUserService, UserService>(); services.AddSingleton<IFrameService, FrameService>(); services.AddSingleton<INoteService, NoteService>(); services.AddTransient<LoginWindow>(); services.AddTransient<AppWindow>(); } protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var loginWindow = ServiceProvider?.GetRequiredService<LoginWindow>(); loginWindow?.Show(); } } }