diff --git a/Toolkit.Avalonia/FileProvider.cs b/Toolkit.Avalonia/FileProvider.cs index 96d6f1e..6f50c58 100644 --- a/Toolkit.Avalonia/FileProvider.cs +++ b/Toolkit.Avalonia/FileProvider.cs @@ -4,7 +4,6 @@ using Toolkit.Foundation; namespace Toolkit.Avalonia; - public class FileProvider(ITopLevelProvider topLevelProvider) : IFileProvider { diff --git a/Toolkit.Avalonia/IServiceCollectionExtensions.cs b/Toolkit.Avalonia/IServiceCollectionExtensions.cs index 2de2873..e1cfe6c 100644 --- a/Toolkit.Avalonia/IServiceCollectionExtensions.cs +++ b/Toolkit.Avalonia/IServiceCollectionExtensions.cs @@ -151,6 +151,9 @@ public static class IServiceCollectionExtensions services.AddTransient((Func>)(provider => new ProxyServiceCollection(services => { + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/Toolkit.Foundation/ContentFactory.cs b/Toolkit.Foundation/ContentFactory.cs index 80ec0f9..eb9c585 100644 --- a/Toolkit.Foundation/ContentFactory.cs +++ b/Toolkit.Foundation/ContentFactory.cs @@ -1,21 +1,12 @@ namespace Toolkit.Foundation; -public class ContentFactory(IMediator mediator, - IServiceProvider provider, +public class ContentFactory(IServiceProvider provider, IServiceFactory factory) : IContentFactory { - public async Task CreateAsync(IContentTemplateDescriptor descriptor, + public Task CreateAsync(IContentTemplateDescriptor descriptor, object[] parameters) { - Type createEventType = typeof(CreateEventArgs<>).MakeGenericType(descriptor.ContentType); - - object? content = null; - if (Activator.CreateInstance(createEventType, [null, parameters]) is object createEvent) - { - content = await mediator.Handle(descriptor.ContentType, createEvent, descriptor.Key); - } - - content ??= parameters is { Length: > 0 } + object? content = parameters is { Length: > 0 } ? factory.Create(descriptor.ContentType, args => { if (args is IInitialization initialization) @@ -31,6 +22,6 @@ public class ContentFactory(IMediator mediator, } }, descriptor.Key); - return content; + return Task.FromResult(content); } }