Added messaging pipeline
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
using Hyperbar.Windows.Controls;
|
||||
using Hyperbar.Lifecycles;
|
||||
using Hyperbar.Templates;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Hyperbar.Widget.Contextual;
|
||||
using Hyperbar.Windows.Primary;
|
||||
|
||||
namespace Hyperbar.Windows;
|
||||
|
||||
@@ -28,29 +28,30 @@ public partial class App :
|
||||
})
|
||||
.ConfigureServices((context, services) =>
|
||||
{
|
||||
services.AddSingleton<IServiceFactory>(provider =>
|
||||
new ServiceFactory((type, parameters) => ActivatorUtilities.CreateInstance(provider, type, parameters!)));
|
||||
|
||||
services.AddHostedService<AppService>();
|
||||
|
||||
services.AddTransient<IInitializer, AppInitializer>();
|
||||
services.AddTransient<DesktopFlyout>();
|
||||
|
||||
services.AddTransient<ITemplateFactory, TemplateFactory>();
|
||||
services.AddTransient<ITemplateGeneratorFactory, TemplateGeneratorFactory>();
|
||||
|
||||
services.AddTransient<DesktopFlyout>();
|
||||
services.AddContentTemplate<CommandViewModel, CommandView>();
|
||||
|
||||
//services.AddCommand<ContextualCommandWidgetBuilder>("");
|
||||
//services.AddWidget<PrimaryCommandWidgetBuilder>("");
|
||||
services.AddWidget<ContextualWidgetBuilder>();
|
||||
services.AddWidget<PrimaryWidgetBuilder>();
|
||||
|
||||
services.AddTransient(provider =>
|
||||
{
|
||||
static IEnumerable<IWidgetViewModel> Resolve(IServiceProvider services)
|
||||
{
|
||||
foreach (IWidgetContext commandContext in services.GetServices<IWidgetContext>())
|
||||
foreach (IWidgetContext widgetContext in services.GetServices<IWidgetContext>())
|
||||
{
|
||||
if (commandContext.ServiceProvider.GetService<IWidgetViewModel>() is
|
||||
IWidgetViewModel commandViewModel)
|
||||
if (widgetContext.ServiceProvider.GetService<IWidgetViewModel>() is
|
||||
IWidgetViewModel viewModel)
|
||||
{
|
||||
yield return commandViewModel;
|
||||
yield return viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user