using CustomExtensions.WinUI; using Hyperbar.Controls.Windows; using Hyperbar.Interop.Windows; using Hyperbar.UI.Windows; using Hyperbar.Widget; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml; using System.Reflection; namespace Hyperbar.Windows; public partial class App : Application { public App() { InitializeComponent(); ApplicationExtensionHost.Initialize(this); } protected override async void OnLaunched(LaunchActivatedEventArgs args) { base.OnLaunched(args); IHost? host = new HostBuilder() .UseContentRoot(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Assembly.GetEntryAssembly()?.GetName().Name!), true) .ConfigureAppConfiguration(config => { config.AddJsonFile("Settings.json", true, true); }) .ConfigureServices((context, services) => { services.AddDefault(); services.AddWidget(); services.AddHostedService(); services.AddSingleton(new Dispatcher(DispatcherQueue.GetForCurrentThread())); services.AddTransient(); services.AddHandler(); services.AddConfiguration(args => { args.Placement = DesktopBarPlacemenet.Top; }); services.AddTransient(); services.AddSingleton(); services.AddContentTemplate(); services.AddTransient>(provider => new ProxyServiceCollection(services => { services.AddSingleton(new Dispatcher(DispatcherQueue.GetForCurrentThread())); services.AddTransient, WidgetContainerFactory>(); services.AddTransient(); services.AddScoped(); services.AddHandler(); services.AddHandler(); services.AddHandler(); services.AddTransient(); services.AddContentTemplate(); services.AddContentTemplate(); services.AddContentTemplate(); })); }) .Build(); await host.RunAsync(); } }