Rely on routing for window content

This commit is contained in:
Pat Hartl 2025-11-09 14:31:41 -06:00
parent f05e125809
commit 0917437dec
5 changed files with 44 additions and 23 deletions

View file

@ -1,16 +1,24 @@
@using Photino.Blazor.CustomWindow.Components
@inject LocalizationService LocalizationService
@inject LocalizationService LocalizationService
@inject NavigationManager NavigationManager
<CustomWindow HeaderHeight="37">
<WindowContent>
<div style="padding-top: 37px">
<ErrorHandler Title="@LocalizationService.GetString("LauncherCrashed")">
<Body>
<Chat/>
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(Windows.ChatWindow)" />
</Found>
<NotFound>
<PageTitle>@LocalizationService.GetString("NotFound")</PageTitle>
<LayoutView Layout="@typeof(Windows.ChatWindow)">
<p role="alert">@LocalizationService.GetString("NotFoundMessage")</p>
</LayoutView>
</NotFound>
</Router>
<AntContainer/>
</Body>
</ErrorHandler>
</div>
</WindowContent>
</CustomWindow>
@code {
protected override void OnInitialized()
{
var currentUri = new Uri(NavigationManager.Uri);
if (currentUri.LocalPath == "/")
NavigationManager.NavigateTo("/Chat", true);
}
}

View file

@ -1,14 +1,24 @@
@using LANCommander.Launcher.Services
@inject LocalizationService LocalizationService
@inject LocalizationService LocalizationService
@inject NavigationManager NavigationManager
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(UI.MainLayout)" />
<RouteView RouteData="@routeData" DefaultLayout="@typeof(Windows.MainWindow)" />
</Found>
<NotFound>
<PageTitle>@LocalizationService.GetString("NotFound")</PageTitle>
<LayoutView Layout="@typeof(UI.MainLayout)">
<LayoutView Layout="@typeof(Windows.MainWindow)">
<p role="alert">@LocalizationService.GetString("NotFoundMessage")</p>
</LayoutView>
</NotFound>
</Router>
</Router>
@code {
protected override void OnInitialized()
{
var currentUri = new Uri(NavigationManager.Uri);
if (currentUri.LocalPath == "/")
NavigationManager.NavigateTo("/Library", true);
}
}

View file

@ -1,5 +1,5 @@
@page "/"
@page "/{id:guid}"
@page "/Library"
@page "/Library/{id:guid}"
@using LANCommander.Launcher.Data.Models
@using LANCommander.Launcher.Models
@using LANCommander.Launcher.UI.Library.Components
@ -59,7 +59,7 @@
async Task SelectLibraryItem(Guid id)
{
NavigationManager.NavigateTo($"/{id}");
NavigationManager.NavigateTo($"/Library/{id}");
}
async Task OnLibraryItemSelected(Models.ListItem item)

View file

@ -0,0 +1,3 @@
@page "/Chat"
<Chat />

View file

@ -1,7 +1,7 @@
@page "/Settings"
@using System.Globalization
@using LANCommander.Launcher.Models
@using LANCommander.SDK.Providers
@layout AuthenticatedLayout
@inject NavigationManager NavigationManager
@inject UpdateService UpdateService
@inject SDK.Client Client