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:
@@ -1,6 +1,4 @@
|
||||
using Hyperbar.Windows.Contextual;
|
||||
using Hyperbar.Windows.Controls;
|
||||
using Hyperbar.Windows.Primary;
|
||||
using Hyperbar.Windows.Controls;
|
||||
using Hyperbar.Lifecycles;
|
||||
using Hyperbar.Templates;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@@ -38,19 +36,19 @@ public partial class App :
|
||||
services.AddTransient<ITemplateFactory, TemplateFactory>();
|
||||
services.AddTransient<ITemplateGeneratorFactory, TemplateGeneratorFactory>();
|
||||
|
||||
services.AddDataTemplate<CommandViewModel, CommandView>();
|
||||
services.AddContentTemplate<CommandViewModel, CommandView>();
|
||||
|
||||
services.AddCommand<ContextualCommandWidgetBuilder>("");
|
||||
services.AddCommand<PrimaryCommandWidgetBuilder>("");
|
||||
//services.AddCommand<ContextualCommandWidgetBuilder>("");
|
||||
//services.AddWidget<PrimaryCommandWidgetBuilder>("");
|
||||
|
||||
services.AddTransient(provider =>
|
||||
{
|
||||
static IEnumerable<ICommandWidgetViewModel> Resolve(IServiceProvider services)
|
||||
static IEnumerable<IWidgetViewModel> Resolve(IServiceProvider services)
|
||||
{
|
||||
foreach (ICommandWidgetContext commandContext in services.GetServices<ICommandWidgetContext>())
|
||||
foreach (IWidgetContext commandContext in services.GetServices<IWidgetContext>())
|
||||
{
|
||||
if (commandContext.ServiceProvider.GetService<ICommandWidgetViewModel>() is
|
||||
ICommandWidgetViewModel commandViewModel)
|
||||
if (commandContext.ServiceProvider.GetService<IWidgetViewModel>() is
|
||||
IWidgetViewModel commandViewModel)
|
||||
{
|
||||
yield return commandViewModel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user