Bunch of insane work

This commit is contained in:
TheXamlGuy
2024-02-08 22:16:58 +00:00
parent 28d79f77d0
commit 2aeb4d1b54
58 changed files with 547 additions and 326 deletions
@@ -0,0 +1,23 @@
using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar;
public class ViewModelTemplateFactory(IViewModelTemplateDescriptorProvider descriptors,
IServiceProvider services) :
IViewModelTemplateFactory
{
public object? Create(object key)
{
if (descriptors.Get(key)
is IViewModelTemplateDescriptor descriptor)
{
if (services.GetRequiredKeyedService(descriptor.TemplateType,
descriptor.Key) is { } template)
{
return template;
}
}
return default;
}
}