cambooth/src/CamBooth/CamBooth.App/App.xaml.cs
2025-01-19 18:25:10 +01:00

45 lines
1.1 KiB
C#

using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Windows;
using CamBooth.App.Core.AppSettings;
using CamBooth.App.Core.Logging;
using CamBooth.App.DebugConsole;
using CamBooth.App.LiveView;
using CamBooth.App.PictureGallery;
using Microsoft.Extensions.DependencyInjection;
namespace CamBooth.App;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private IServiceProvider _serviceProvider;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
var mainWindow = _serviceProvider.GetRequiredService<MainWindow>();
mainWindow.Show();
}
private void ConfigureServices(IServiceCollection services)
{
// Register your services and view models here
services.AddTransient<MainWindow>();
services.AddSingleton<Logger>();
services.AddSingleton<AppSettingsService>();
services.AddSingleton<PictureGalleryService>();
}
}