restructure project for part 2
This commit is contained in:
@@ -1,27 +1,30 @@
|
||||
using Hyperbar.Widget;
|
||||
using Hyperbar.Windows.Controls;
|
||||
using Hyperbar.Windows.Interop;
|
||||
using Hyperbar.Windows.UI;
|
||||
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.Configuration.Json;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Windows.Media.Control;
|
||||
|
||||
namespace Hyperbar.Windows;
|
||||
|
||||
public partial class App :
|
||||
Application
|
||||
{
|
||||
public App() => InitializeComponent();
|
||||
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)
|
||||
@@ -71,35 +74,9 @@ public partial class App :
|
||||
services.AddContentTemplate<WidgetButtonViewModel, WidgetButtonView>();
|
||||
services.AddContentTemplate<WidgetSplitButtonViewModel, WidgetSplitButtonView>();
|
||||
}));
|
||||
|
||||
//services.AddTransient(provider =>
|
||||
//{
|
||||
// static IEnumerable<WidgetContainerViewModel> Resolve(IServiceProvider services)
|
||||
// {
|
||||
// int index = 0;
|
||||
// foreach (WidgetContext widgetContext in services.GetServices<WidgetContext>())
|
||||
// {
|
||||
// if (widgetContext.ServiceProvider.GetService<IWidget>() is IWidget widget)
|
||||
// {
|
||||
// if (widgetContext.ServiceProvider.GetServices<IWidgetViewModel>() is
|
||||
// IEnumerable<IWidgetViewModel> viewModels)
|
||||
// {
|
||||
// yield return (WidgetContainerViewModel)ActivatorUtilities.CreateInstance(widgetContext.ServiceProvider,
|
||||
// typeof(WidgetContainerViewModel), viewModels, index % 2 == 1, widget.Id);
|
||||
|
||||
// index++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// return Resolve(provider);
|
||||
//});
|
||||
})
|
||||
.Build();
|
||||
|
||||
var d = host.Services.GetService<JsonConfigurationProvider>();
|
||||
|
||||
await host.RunAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user