diff options
Diffstat (limited to 'MatrixRoomUtils.Desktop/App.axaml.cs')
-rw-r--r-- | MatrixRoomUtils.Desktop/App.axaml.cs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/MatrixRoomUtils.Desktop/App.axaml.cs b/MatrixRoomUtils.Desktop/App.axaml.cs index 3dfcdee..3fe8862 100644 --- a/MatrixRoomUtils.Desktop/App.axaml.cs +++ b/MatrixRoomUtils.Desktop/App.axaml.cs @@ -4,6 +4,7 @@ using Avalonia.Markup.Xaml; using MatrixRoomUtils.Core.Services; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Sentry; namespace MatrixRoomUtils.Desktop; @@ -16,20 +17,24 @@ public partial class App : Application { public override void OnFrameworkInitializationCompleted() { host = Host.CreateDefaultBuilder().ConfigureServices((ctx, services) => { - services.AddScoped<MRUDesktopConfiguration>(); - services.AddScoped<TieredStorageService>(x => + services.AddSingleton<MRUDesktopConfiguration>(); + services.AddSingleton<SentryService>(); + services.AddSingleton<TieredStorageService>(x => new( cacheStorageProvider: new FileStorageProvider(x.GetService<MRUDesktopConfiguration>().CacheStoragePath), - dataStorageProvider: new FileStorageProvider(x.GetService<MRUDesktopConfiguration>().CacheStoragePath) + dataStorageProvider: new FileStorageProvider(x.GetService<MRUDesktopConfiguration>().DataStoragePath) ) ); + services.AddSingleton(new RoryLibMatrixConfiguration() { + AppName = "MatrixRoomUtils.Desktop" + }); services.AddRoryLibMatrixServices(); // foreach (var commandClass in new ClassCollector<ICommand>().ResolveFromAllAccessibleAssemblies()) { // Console.WriteLine($"Adding command {commandClass.Name}"); // services.AddScoped(typeof(ICommand), commandClass); // } - services.AddScoped<MRUStorageWrapper>(); - services.AddScoped<MainWindow>(); + services.AddSingleton<MRUStorageWrapper>(); + services.AddSingleton<MainWindow>(); services.AddSingleton(this); }).UseConsoleLifetime().Build(); |