Files
frameledger/src/FrameLedger.App/MainWindow.xaml
T
poli0981andClaude Fable 5.1 e16185f60e feat(app): the first .resx family with its generator and gate, and the App shell -- Generic Host, FluentWindow, the Agent pill over the pipe, theme + language persisted (P3 PR-2) (#155)
resx: src/FrameLedger.App/Strings.resx + .vi + .ja (65 keys; ja machine-drafted,
marked `review`), tools/resx-gen.ps1 writing the committed Strings.Designer.cs (the
SDK-style WPF project runs no ResXFileCodeGenerator), tools/resx-audit.ps1 as
build.ps1 step 15: -SelfTest (11 fixture cases, 9 red) then live. Per family:
identifier keys, non-empty neutral values, EXACT key sets in vi/ja, Safety_* in ja
marked `safety: human review required` with the English verbatim (that is how "shown
as en until signed" is true by construction) or `safety: reviewed by <name>`, and the
accessor current. No family under src/ is red, not green.

App: Generic Host per 16_WPFUI §App bootstrap; FluentWindow with the Agent pill in
the TitleBar, the Menu row (unbuilt items say so in a snackbar), NavigationView with
Settings in the footer, the offline InfoBar + Retry, SnackbarPresenter,
ContentDialogHost. Theme (Light/Dark/System + SystemThemeWatcher) and language
(rebuilds the shell in the new culture) persisted in `settings` under D16's
ui.theme/ui.language through SqliteSettingsStore -- the App opens ledger.db directly
(06_DATA_MODEL §Writer ownership, D15). Services.AgentConnection is 07_IPC §Client
behavior as a state machine over PipeClient: 8 x 250 ms, start
FrameLedger.Agent.exe --serve beside the App when absent, Hello/GetStatus, keepalive,
the event stream, retry every 5 s. Dashboard shows the Agent card with N/A until
answered; Games/Compare/Logs are empty states. Serilog logs/ui-.log per 10_LOGGING.

Three things 16_WPFUI now records: MainWindow is transient with
ShutdownMode=OnExplicitShutdown and the host lifetime ending the process; the run is
one Task from a synchronous OnStartup (async void overrides are VSTHRD100 here); and
ApplicationThemeManager.Apply(..., updateAccent: true) must precede the first
window's XAML or the accent resources are missing at first Measure (measured:
XamlParseException 'SystemAccentColorPrimary').

tests/FrameLedger.App.Tests (16): every key resolves in en/vi/ja and the satellites
really load; the accessor's keys are the resx's; appearance settings round-trip; the
connection against an in-process PipeServer -- Missing with nothing to start,
Connected on Hello, Starting -> Connected through a launcher that brings the server
up, Offline then Connected again when it returns. First window measured at 1.3 s.

Docs corrected in place: 09_I18N (generator, audit as built, the ja Safety_* rule),
12_BUILD line 15, 13_CI_CD, CLAUDE.md (App is the shell; resx-audit exists),
08_UI §Shell built note, 16_WPFUI deviations + gotcha, 10_LOGGING ui log, HANDOFF
§P3 row 2 struck (Shared's family waits for PR-4 on purpose). CHANGELOG.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-14 12:45:40 +07:00

104 lines
6.2 KiB
XML

<ui:FluentWindow x:Class="FrameLedger.App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:pages="clr-namespace:FrameLedger.App.Pages"
xmlns:res="clr-namespace:FrameLedger.App"
Title="{x:Static res:Strings.App_Title}"
Width="1180"
Height="760"
MinWidth="800"
MinHeight="520"
ExtendsContentIntoTitleBar="True"
WindowBackdropType="Mica"
WindowCornerPreference="Round"
WindowStartupLocation="CenterScreen">
<!--
docs/16_WPFUI_SYNTAX.md §Main window skeleton: TitleBar row, a classic Menu row BELOW it (never inside the
drag region), then the NavigationView. Every string is a resx key; every colour a theme brush.
-->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ui:TitleBar Grid.Row="0" Title="{x:Static res:Strings.App_Title}">
<ui:TitleBar.TrailingContent>
<ui:Badge Margin="0,0,12,0"
VerticalAlignment="Center"
Appearance="{Binding ViewModel.AgentStatusAppearance}"
Content="{Binding ViewModel.AgentStatusText}" />
</ui:TitleBar.TrailingContent>
</ui:TitleBar>
<Menu Grid.Row="1">
<MenuItem Header="{x:Static res:Strings.Menu_File}">
<MenuItem Header="{x:Static res:Strings.Menu_File_AddGame}" Command="{Binding ViewModel.NotYetCommand}" />
<MenuItem Header="{x:Static res:Strings.Menu_File_ImportLibrary}" Command="{Binding ViewModel.NotYetCommand}" />
<MenuItem Header="{x:Static res:Strings.Menu_File_Export}" Command="{Binding ViewModel.NotYetCommand}" />
<Separator />
<MenuItem Header="{x:Static res:Strings.Menu_File_Exit}" Command="{Binding ViewModel.ExitCommand}" />
</MenuItem>
<MenuItem Header="{x:Static res:Strings.Menu_Tools}">
<MenuItem Header="{x:Static res:Strings.Menu_Tools_AgentStatus}" Command="{Binding ViewModel.NotYetCommand}" />
<MenuItem Header="{x:Static res:Strings.Menu_Tools_UpdateRules}" Command="{Binding ViewModel.NotYetCommand}" />
<MenuItem Header="{x:Static res:Strings.Menu_Tools_VulkanLayer}" Command="{Binding ViewModel.NotYetCommand}" />
<MenuItem Header="{x:Static res:Strings.Menu_Tools_OpenDataFolder}" Command="{Binding ViewModel.OpenDataFolderCommand}" />
<MenuItem Header="{x:Static res:Strings.Menu_Tools_DbMaintenance}" Command="{Binding ViewModel.NotYetCommand}" />
</MenuItem>
<MenuItem Header="{x:Static res:Strings.Menu_Help}">
<MenuItem Header="{x:Static res:Strings.Menu_Help_CheckUpdates}" Command="{Binding ViewModel.NotYetCommand}" />
<MenuItem Header="{x:Static res:Strings.Menu_Help_ReportBug}" Command="{Binding ViewModel.NotYetCommand}" />
<MenuItem Header="{x:Static res:Strings.Menu_Help_Documentation}" Command="{Binding ViewModel.NotYetCommand}" />
<Separator />
<MenuItem Header="{x:Static res:Strings.Menu_Help_About}" Command="{Binding ViewModel.AboutCommand}" />
</MenuItem>
</Menu>
<!-- 08_UI §Notifications policy: "Agent offline" is in-app and PERSISTENT — an InfoBar with an action, never a toast. -->
<ui:InfoBar Grid.Row="2"
Margin="12,4,12,0"
IsClosable="False"
IsOpen="{Binding ViewModel.IsAgentBannerVisible}"
Message="{Binding ViewModel.AgentBannerBody}"
Severity="Warning"
Title="{x:Static res:Strings.Agent_Banner_Offline_Title}">
<ui:Button Appearance="Secondary"
Command="{Binding ViewModel.RetryAgentCommand}"
Content="{x:Static res:Strings.Agent_Banner_Retry}" />
</ui:InfoBar>
<ui:NavigationView x:Name="RootNavigation"
Grid.Row="3"
IsBackButtonVisible="Collapsed"
IsPaneToggleVisible="False"
PaneDisplayMode="LeftFluent">
<ui:NavigationView.MenuItems>
<ui:NavigationViewItem Content="{x:Static res:Strings.Nav_Dashboard}"
Icon="{ui:SymbolIcon Home24}"
TargetPageType="{x:Type pages:DashboardPage}" />
<ui:NavigationViewItem Content="{x:Static res:Strings.Nav_Games}"
Icon="{ui:SymbolIcon Games24}"
TargetPageType="{x:Type pages:GamesPage}" />
<ui:NavigationViewItem Content="{x:Static res:Strings.Nav_Compare}"
Icon="{ui:SymbolIcon ArrowSwap24}"
TargetPageType="{x:Type pages:ComparePage}" />
<ui:NavigationViewItem Content="{x:Static res:Strings.Nav_Logs}"
Icon="{ui:SymbolIcon DocumentText24}"
TargetPageType="{x:Type pages:LogsPage}" />
</ui:NavigationView.MenuItems>
<ui:NavigationView.FooterMenuItems>
<ui:NavigationViewItem Content="{x:Static res:Strings.Nav_Settings}"
Icon="{ui:SymbolIcon Settings24}"
TargetPageType="{x:Type pages:SettingsPage}" />
</ui:NavigationView.FooterMenuItems>
</ui:NavigationView>
<ui:SnackbarPresenter x:Name="SnackbarPresenter" Grid.Row="3" VerticalAlignment="Bottom" />
<ui:ContentDialogHost x:Name="DialogHost" Grid.Row="3" />
</Grid>
</ui:FluentWindow>