diff options
author | Rory& <root@rory.gay> | 2024-01-24 02:31:56 +0100 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-01-24 17:05:25 +0100 |
commit | 03313562d21d5db9bf6a14ebbeab80e06c883d3a (patch) | |
tree | e000546a2ee8e6a886a7ed9fd01ad674178fb7cb /MatrixRoomUtils.Desktop/App.axaml.cs | |
parent | Make RMU installable (diff) | |
download | MatrixUtils-03313562d21d5db9bf6a14ebbeab80e06c883d3a.tar.xz |
MRU->RMU, fixes, cleanup
Diffstat (limited to 'MatrixRoomUtils.Desktop/App.axaml.cs')
-rw-r--r-- | MatrixRoomUtils.Desktop/App.axaml.cs | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/MatrixRoomUtils.Desktop/App.axaml.cs b/MatrixRoomUtils.Desktop/App.axaml.cs deleted file mode 100644 index aeb154c..0000000 --- a/MatrixRoomUtils.Desktop/App.axaml.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Markup.Xaml; -using Avalonia.Styling; -using LibMatrix.Services; -using MatrixRoomUtils.Abstractions; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace MatrixRoomUtils.Desktop; - -public partial class App : Application { - public IHost host { get; set; } - - public override void OnFrameworkInitializationCompleted() { - host = Host.CreateDefaultBuilder().ConfigureServices((ctx, services) => { - services.AddSingleton<MRUDesktopConfiguration>(); - services.AddSingleton<SentryService>(); - services.AddSingleton<TieredStorageService>(x => - new TieredStorageService( - cacheStorageProvider: 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.AddSingleton<MRUStorageWrapper>(); - services.AddSingleton<MainWindow>(); - services.AddSingleton(this); - }).UseConsoleLifetime().Build(); - - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { - var scopeFac = host.Services.GetService<IServiceScopeFactory>(); - var scope = scopeFac.CreateScope(); - desktop.MainWindow = scope.ServiceProvider.GetRequiredService<MainWindow>(); - } - - if(Environment.GetEnvironmentVariable("AVALONIA_THEME")?.Equals("dark", StringComparison.OrdinalIgnoreCase) ?? false) - RequestedThemeVariant = ThemeVariant.Dark; - - base.OnFrameworkInitializationCompleted(); - } -} \ No newline at end of file |