Make custom widgets independent of any WinUI framework concerns. Although one can add WinUI concerns to ther widget if they want to build a fully customized widget. In theory, it may also be possible to host a widget of WPF, Avalonia, or Blazor.

This commit is contained in:
TheXamlGuy
2024-01-06 09:57:23 +00:00
parent 3e88950669
commit 4a27534e39
41 changed files with 218 additions and 205 deletions
@@ -7,10 +7,10 @@ namespace Hyperbar.Windows
{
public static class IServiceCollectionExtensions
{
public static IServiceCollection AddCommand<TCommandBuilder>(this IServiceCollection services,
public static IServiceCollection AddWidget<TCommandBuilder>(this IServiceCollection services,
string key)
where TCommandBuilder :
ICommandWidgetBuilder, new()
IWidgetBuilder, new()
{
TCommandBuilder builder = new();
IHost? host = new HostBuilder()
@@ -22,7 +22,7 @@ namespace Hyperbar.Windows
builder.Create(isolatedServices);
}).Build();
services.AddTransient<ICommandWidgetContext>(provider => new CommandWidgetContext(host.Services));
services.AddTransient<IWidgetContext>(provider => new WidgetContext(host.Services));
return services;
}
}