Added json configuration
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using Hyperbar.Desktop.Contextual;
|
||||
using Hyperbar.Desktop.Controls;
|
||||
using Hyperbar.Desktop.Primary;
|
||||
using Hyperbar.Lifecycles;
|
||||
using Hyperbar.Templates;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.UI.Xaml;
|
||||
@@ -30,11 +32,10 @@ public partial class App :
|
||||
services.AddTransient<ITemplateFactory, TemplateFactory>();
|
||||
services.AddTransient<ITemplateGeneratorFactory, TemplateGeneratorFactory>();
|
||||
|
||||
services.AddDataTemplate<CommandViewModel, CommandView>("Commands");
|
||||
services.AddDataTemplate<CommandViewModel, CommandView>();
|
||||
|
||||
// Commands
|
||||
services.AddSomething<ContextualCommandBuilder>();
|
||||
services.AddSomething<PrimaryCommandBuilder>();
|
||||
services.AddCommandBuilder<ContextualCommandBuilder>("Contexual.Commands");
|
||||
services.AddCommandBuilder<PrimaryCommandBuilder>("Primary.Command");
|
||||
|
||||
services.AddTransient(provider =>
|
||||
{
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Hyperbar.Desktop.Controls;
|
||||
using Hyperbar.Lifecycles;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hyperbar.Desktop;
|
||||
|
||||
public class AppInitializer([FromKeyedServices("Commands")] CommandView view,
|
||||
[FromKeyedServices("Commands")] CommandViewModel viewModel,
|
||||
public class AppInitializer([FromKeyedServices(nameof(CommandView))] CommandView view,
|
||||
[FromKeyedServices(nameof(CommandView))] CommandViewModel viewModel,
|
||||
DesktopFlyout desktopFlyout) :
|
||||
IInitializer
|
||||
{
|
||||
+5
-2
@@ -1,11 +1,14 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Hyperbar.Lifecycles;
|
||||
using Hyperbar.Templates;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Hyperbar.Desktop
|
||||
{
|
||||
public static class IServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddSomething<TCommandBuilder>(this IServiceCollection services)
|
||||
public static IServiceCollection AddCommandBuilder<TCommandBuilder>(this IServiceCollection services,
|
||||
string key)
|
||||
where TCommandBuilder :
|
||||
ICommandBuilder, new()
|
||||
{
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Hyperbar.Templates;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using System;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
using Hyperbar.Templates;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Hyperbar.Desktop;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections;
|
||||
using Hyperbar.Lifecycles;
|
||||
using Hyperbar.Templates;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Hyperbar.Desktop;
|
||||
|
||||
Reference in New Issue
Block a user