diff --git a/Moonlight.Frontend/Configuration/NavigationAssemblyOptions.cs b/Moonlight.Frontend/Configuration/NavigationAssemblyOptions.cs new file mode 100644 index 00000000..bba1104a --- /dev/null +++ b/Moonlight.Frontend/Configuration/NavigationAssemblyOptions.cs @@ -0,0 +1,8 @@ +using System.Reflection; + +namespace Moonlight.Frontend.Configuration; + +public class NavigationAssemblyOptions +{ + public List Assemblies { get; private set; } = new(); +} \ No newline at end of file diff --git a/Moonlight.Frontend/Startup/Startup.Base.cs b/Moonlight.Frontend/Startup/Startup.Base.cs index ffa54244..f490ae57 100644 --- a/Moonlight.Frontend/Startup/Startup.Base.cs +++ b/Moonlight.Frontend/Startup/Startup.Base.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Microsoft.Extensions.DependencyInjection; +using Moonlight.Frontend.Configuration; using Moonlight.Frontend.Implementations; using Moonlight.Frontend.Interfaces; using Moonlight.Frontend.Services; @@ -25,5 +26,10 @@ public partial class Startup builder.Services.AddSingleton(); builder.Services.AddScoped(); + + builder.Services.Configure(options => + { + options.Assemblies.Add(typeof(Startup).Assembly); + }); } } \ No newline at end of file diff --git a/Moonlight.Frontend/UI/App.razor b/Moonlight.Frontend/UI/App.razor index edadd0bd..c9eb9657 100644 --- a/Moonlight.Frontend/UI/App.razor +++ b/Moonlight.Frontend/UI/App.razor @@ -1,6 +1,9 @@ @using System.Net +@using System.Reflection @using LucideBlazor @using Microsoft.AspNetCore.Components.Authorization +@using Microsoft.Extensions.Options +@using Moonlight.Frontend.Configuration @using Moonlight.Frontend.UI.Shared @using Moonlight.Frontend.UI.Shared.Components @using ShadcnBlazor.Emptys @@ -8,12 +11,13 @@ @using Moonlight.Frontend.UI.Shared.Partials @inject NavigationManager Navigation +@inject IOptions NavigationOptions - + @@ -71,4 +75,14 @@ } - \ No newline at end of file + + +@code +{ + private Assembly[] Assemblies; + + protected override void OnInitialized() + { + Assemblies = NavigationOptions.Value.Assemblies.ToArray(); + } +}