-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathApp.razor
More file actions
34 lines (29 loc) · 955 Bytes
/
App.razor
File metadata and controls
34 lines (29 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@using System.Reflection
@using TryMudBlazor.Client.Pages
@using TryMudBlazor.Client.Services
@implements IDisposable
<Router AppAssembly="@typeof(Program).Assembly"
AdditionalAssemblies="@_additionalAssemblies"
NotFoundPage="typeof(NotFound)">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(EmptyLayout)" />
</Found>
</Router>
@code {
private readonly Assembly[] _additionalAssemblies;
private readonly IDisposable _subscription;
public App(UserComponentsAssemblyService assemblyService)
{
_additionalAssemblies = [assemblyService.Assembly];
_subscription = assemblyService.Subscribe(HandleAssemblyChanged);
}
private Task HandleAssemblyChanged(Assembly assembly)
{
_additionalAssemblies[0] = assembly;
return InvokeAsync(StateHasChanged);
}
public void Dispose()
{
_subscription.Dispose();
}
}