Compare commits

...
2 Commits
Author SHA1 Message Date
poli0981andClaude Opus 5.5 0b846084cc refactor(app): the library's Not installed pill reads the file the game page's way - GameLibrary.ExecutableExists and its sentence - instead of a second probe and two more strings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 10:35:27 +07:00
poli0981andClaude Opus 5.5 36f1b9d787 feat(app): the Games library fills the window, switches to a list, counts and refreshes its games; import hides what is already in it (beta.11)
Owner requests 2026-10-03 (screenshots): the empty band right of the library; a manual refresh
for when games are installed or uninstalled; import's games already in the library, dimmed or
hidden. The owner chose, when asked: the refresh does all three (reload, new games from the
stores, mark uninstalled games), and the view switches between a filling grid and a list.

Library (Games page):
- Controls.UniformWrapPanel: as many columns as fit at 300 px or wider, every card an equal share
  of the width, each row as tall as its tallest card - the cards were 300 px in a WrapPanel, so a
  card's width went unused at the right. The pill row wraps instead of cutting its last pill.
- A list view (name, store, engine, status, sessions, played, last played; double-click or Enter
  opens a game); the button beside the sort shows the other view; ui.library_view remembers it.
- The title counts the games ("Games - 42").
- Refresh reads the library again, then ImportLibraryFlow.RunAsync(onlyNew: true) asks the stores
  for games installed since ("No new games" and no checklist when there are none), and every
  entry whose executable is not on disk carries a "Not installed" pill whose tooltip names the path
  and says when the drive itself is not connected (ExecutablePresenceProbe, off the UI thread on
  each listing, never stored; nothing is removed).
- The page reloads itself while on screen when a session ends (SessionCompleted) or an import adds
  games (LibraryChanges): navigating to the page already on screen does nothing in WPF UI 4.3.0, so
  an import from the menu showed only after leaving the page.

Import (FR-1.2): the games already in the library - at this path or under another drive letter -
are hidden by default; "Show the N games already in the library" brings them back dimmed; a row
that cannot be imported has its box disabled (the XAML said "cannot be ticked" while a tick was
taken and ignored).

Strings en/vi/ja; 08_UI, 06_DATA_MODEL (ui.library_view), CHANGELOG. Tests: GamesViewModelTests
(reload on import and session end, not after Detach; presence; column math), ImportLibraryFlowTests
(refresh offers only new games; hidden until asked), PagesLoadTests (the grid fills its width; the
list replaces it and is remembered; the checklist renders with existing rows shown). Rendered to
PNG in a hosted window to look at it (1270 px: three columns; 900 px: two; the list).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 10:25:51 +07:00
22 changed files with 1010 additions and 34 deletions

No files matched your search

+13
View File
@@ -29,6 +29,19 @@ under a `## [x.y.z] - date` heading in the same commit that bumps `VERSION`, the
### Added
- **The Games library fills the window, switches to a list, counts its games and refreshes** (owner requests, beta.11).
The cards were 300 px in a plain wrap, so a wide window left up to a card's width empty at the right and the third pill
("Hooking off") was cut; the grid now has as many columns as fit at 300 px or wider, every card an equal share of the
width, and the pills wrap. A button beside the sort switches to a **list** — one row per game with its store, engine,
status, sessions, playtime and last played — and the choice is remembered (`ui.library_view`). The title counts the
games. **Refresh** reads the library again, looks in the stores for games installed since and offers only those (*No
new games* when there are none), and marks every entry whose executable is gone **Not installed** — the tooltip says
when it is the drive that is not connected; nothing is removed. The page also reloads by itself when a session ends or
an import adds games while it is open (an import made from the menu used to show only after leaving the page).
- **Import hides the games already in the library** (owner request, beta.11): on a re-import they were most of the list
and pushed the new ones out of sight. *Show the N games already in the library* brings them back, dimmed, and a row
that cannot be imported has its box disabled (a tick on it was taken and ignored).
- **Three CrackProof titles on the anti-cheat title list** (owner request, beta.11): Umamusume: Pretty Derby (Steam
`3224770`), Heaven Burns Red (`1973710`) and Madoka Magica Magia Exedra (`2987800`). Each store page states *"Uses
Kernel Level Anti-Cheat"* and names HyperTech's CrackProof; its driver loads from `System32` under a numbered name,
+1
View File
@@ -391,6 +391,7 @@ switch's rule); integers are invariant-culture within an inclusive range; choice
| `ui.minimize_to_tray` | bool | `0` | | UI (PR-8) |
| `ui.hide_anticheat_hooking` | bool | `1` | | UI (beta.8, 2026-09-25): the game page of an entry the guard found anti-cheat in shows the finding in place of its Hooking card (`08_UI` §Game detail) |
| `ui.fps_decimals` | bool | `0` | | UI (beta.8, 2026-09-25): every FPS figure with two decimals ("62.40") instead of a whole number |
| `ui.library_view` | choice `grid`\|`list` | `grid` | | UI (beta.11, 2026-10-03): the Games library as a grid of cards that fills the width, or as a list; written by the page's own switch, no Settings row (`08_UI` §Games) |
| `capture.background` | bool | `1` | | Agent |
| `hooking.kill_switch` | bool | `0` | | Agent (FR-2.4, since P2 PR-F) |
| `hooking.usermode_ac_exceptions` | bool | `0` | | Agent, at every session start and command (FR-2.8, D33, 2026-09-26): off suspends every user-mode exception without deleting any; on, the user still grants each eligible game |
+19
View File
@@ -175,6 +175,25 @@ All screens are `Page`s registered with the navigation page provider and navigat
### Games (grid → detail)
- `GridView`-style panel of cover cards (`ui:CardAction`): name, platform badge, engine badge, total playtime, last played, mini trend sparkline (avg Native FPS last 10 sessions). Sort/filter/`ui:AutoSuggestBox` search.
> **The library, beta.11 (owner requests 2026-10-03).** *The empty band on the right:* the cards were 300 px in a plain
> `WrapPanel`, so at ~1350 px three fitted and a card's width was left unused; the grid is now
> `Controls.UniformWrapPanel` — as many columns as fit at 300 px or wider, every card an equal share of the width, each row
> as tall as its tallest card — and the pill row wraps instead of cutting its last pill. **Grid or list** (owner's choice:
> switch between the two): the button beside the sort shows the other view; the list is one row per game (name, store,
> engine, status, sessions, played, last played; double-click or Enter opens it), and the choice is `ui.library_view`.
> **The count** is in the title (*Games · 42*). **Refresh** reads the library again, then asks the stores for games installed
> since (`ImportLibraryFlow.RunAsync(onlyNew: true)`: *No new games* and no checklist when there are none), and every entry
> whose executable is not on disk carries a **Not installed** pill — its tooltip is the game page's own sentence for it,
> the drive that is not connected or the path the file is gone from (`GameLibrary.ExecutableExists` and
> `Formats.ExecutableMissingText`, asked off the UI thread on every listing, never stored; nothing is removed for it). **The page reloads by itself** while it is on screen when a session ends (`SessionCompleted`) or an
> import adds games (`LibraryChanges` — navigating to the page already on screen does nothing in WPF UI 4.3.0, so an
> import from the menu never showed until the page was left). **Import** (FR-1.2): the games already in the library — at
> this path or under another drive letter — are hidden by default (*Show the N games already in the library* brings them
> back, dimmed), and a row that cannot be imported has its box disabled; the XAML comment said "cannot be ticked" while a
> tick was taken and ignored. Tests: `GamesViewModelTests`, `ImportLibraryFlowTests.RefreshOffersOnlyNewGamesAndSaysWhenThereAreNone`,
> `…GamesAlreadyInTheLibraryAreHiddenUntilAskedFor`, `PagesLoadTests.TheLibraryGridFillsItsWidthAndTheListViewReplacesIt`,
> `…TheImportChecklistRendersWithTheExistingRowsShown`.
>
- **Game detail:**
- Header: cover, name, publisher, version, platform, engine+version, API + Present Mode of last session, `FpsReadout` (lifetime avg), TriState chips, Edit button.
- **Two clearly separated rows** (`05_DETECTION` §Capability hints — conflating these was the old design's core mistake):
+2
View File
@@ -417,6 +417,8 @@ public partial class App : System.Windows.Application
sp.GetRequiredService<IExecutableLocator>(),
static line => Serilog.Log.Information("{Line}", line)));
services.AddSingleton<IImportReview, ImportReviewPrompt>();
// beta.11: the Games page on screen reloads when an import adds games (navigating to itself does nothing).
services.AddSingleton<LibraryChanges>();
services.AddSingleton<ImportLibraryFlow>();
}
@@ -0,0 +1,105 @@
using System.Windows;
using System.Windows.Controls;
namespace FrameLedger.App.Controls;
/// <summary>
/// The library grid's panel (beta.11, owner request 2026-10-03: "the empty band on the right"): as many columns as
/// <see cref="MinItemWidth"/> allows across the width it is given, every item stretched to an equal share of it, so a row
/// is always full — a plain <see cref="WrapPanel"/> of 300 px cards left up to a card's width unused at the right. Each row
/// is as tall as its tallest item. Not virtualizing: a library is hundreds of rows at most.
/// </summary>
public sealed class UniformWrapPanel : Panel
{
public static readonly DependencyProperty MinItemWidthProperty = DependencyProperty.Register(
nameof(MinItemWidth), typeof(double), typeof(UniformWrapPanel), new FrameworkPropertyMetadata(300.0, FrameworkPropertyMetadataOptions.AffectsMeasure));
public static readonly DependencyProperty SpacingProperty = DependencyProperty.Register(
nameof(Spacing), typeof(double), typeof(UniformWrapPanel), new FrameworkPropertyMetadata(12.0, FrameworkPropertyMetadataOptions.AffectsMeasure));
/// <summary>The narrowest an item may be; the column count is the most that fit at this width or wider.</summary>
public double MinItemWidth
{
get => (double)GetValue(MinItemWidthProperty);
set => SetValue(MinItemWidthProperty, value);
}
/// <summary>The gap between columns and between rows.</summary>
public double Spacing
{
get => (double)GetValue(SpacingProperty);
set => SetValue(SpacingProperty, value);
}
/// <summary>How many columns of at least <paramref name="minItemWidth"/> fit in <paramref name="width"/>, never fewer than one.</summary>
public static int ColumnsFor(double width, double minItemWidth, double spacing)
{
if (double.IsNaN(width) || double.IsInfinity(width) || minItemWidth <= 0)
{
return 1;
}
return Math.Max(1, (int)Math.Floor((width + spacing) / (minItemWidth + spacing)));
}
/// <summary>Each item's width when <paramref name="columns"/> share <paramref name="width"/> with gaps between them.</summary>
public static double ItemWidthFor(double width, int columns, double spacing) =>
columns <= 0 ? 0 : Math.Max(0, (width - ((columns - 1) * spacing)) / columns);
protected override Size MeasureOverride(Size availableSize)
{
double width = double.IsInfinity(availableSize.Width) ? MinItemWidth : availableSize.Width;
int columns = ColumnsFor(width, MinItemWidth, Spacing);
double itemWidth = ItemWidthFor(width, columns, Spacing);
double height = 0;
double rowHeight = 0;
int column = 0;
int rows = 0;
foreach (UIElement child in InternalChildren)
{
child.Measure(new Size(itemWidth, double.PositiveInfinity));
rowHeight = Math.Max(rowHeight, child.DesiredSize.Height);
if (++column == columns)
{
height += rowHeight;
rows++;
rowHeight = 0;
column = 0;
}
}
if (column > 0)
{
height += rowHeight;
rows++;
}
return new Size(width, height + (Math.Max(0, rows - 1) * Spacing));
}
protected override Size ArrangeOverride(Size finalSize)
{
int columns = ColumnsFor(finalSize.Width, MinItemWidth, Spacing);
double itemWidth = ItemWidthFor(finalSize.Width, columns, Spacing);
UIElement[] children = [.. InternalChildren.Cast<UIElement>()];
double y = 0;
for (int start = 0; start < children.Length; start += columns)
{
int end = Math.Min(start + columns, children.Length);
double rowHeight = 0;
for (int i = start; i < end; i++)
{
rowHeight = Math.Max(rowHeight, children[i].DesiredSize.Height);
}
for (int i = start; i < end; i++)
{
children[i].Arrange(new Rect((i - start) * (itemWidth + Spacing), y, itemWidth, rowHeight));
}
y += rowHeight + Spacing;
}
return finalSize;
}
}
@@ -10,14 +10,35 @@
MinWidth="640">
<!--
FR-1.2's review checklist: nothing is added until the user says which; a row that is already in the library
or has no executable cannot be ticked. Import never enables hooking (the intro says so).
or has no executable cannot be ticked (its box is disabled since beta.11 - before, a tick was taken and ignored).
Rows already in the library are hidden unless "Show the N games already in the library" is ticked, and then
dimmed. Import never enables hooking (the intro says so).
-->
<StackPanel>
<ui:TextBlock TextWrapping="Wrap" Text="{x:Static vm:ImportReviewViewModel.Intro}" />
<CheckBox Margin="0,8,0,0" Content="{Binding ShowExistingText}" IsChecked="{Binding ShowExisting, Mode=TwoWay}"
Visibility="{Binding HasExisting, Converter={StaticResource BoolToVis}}" />
<DataGrid Margin="0,10,0,8" MaxHeight="360" AutoGenerateColumns="False" CanUserAddRows="False" HeadersVisibility="Column"
ItemsSource="{Binding Rows}" SelectionMode="Single" IsReadOnly="False">
ItemsSource="{Binding Shown}" SelectionMode="Single" IsReadOnly="False">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsExisting}" Value="True">
<Setter Property="Opacity" Value="0.55" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridCheckBoxColumn Binding="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}" Width="40" />
<DataGridTemplateColumn Width="40">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox HorizontalAlignment="Center" IsEnabled="{Binding CanImport}"
AutomationProperties.Name="{Binding Name}"
IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static vm:ImportReviewViewModel.ColumnPlatform}" Binding="{Binding PlatformText}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static vm:ImportReviewViewModel.ColumnName}" Binding="{Binding Name}" IsReadOnly="True" Width="2*" />
<DataGridTextColumn Header="{x:Static vm:ImportReviewViewModel.ColumnExe}" Binding="{Binding ExeText}" IsReadOnly="True" Width="3*" />
+65 -12
View File
@@ -4,10 +4,16 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:res="clr-namespace:FrameLedger.App"
xmlns:vm="clr-namespace:FrameLedger.App.ViewModels"
xmlns:controls="clr-namespace:FrameLedger.App.Controls"
Title="{x:Static res:Strings.Games_Header}"
AllowDrop="True"
Drop="OnDrop">
<!-- 08_UI §Games: cards (ui:CardAction), search, sort; FR-1.1 add by pick or by dropping an .exe here. -->
<!--
08_UI §Games: search, sort, FR-1.1 add by pick or by dropping an .exe here. Since beta.11 (owner requests 2026-10-03):
the count in the title; a grid of cards that fills the width (UniformWrapPanel - a WrapPanel of 300 px cards left a
card's width unused at the right) or a list (ui.library_view); Refresh reads the library again, offers the games the
stores installed since, and marks the entries whose executable is gone.
-->
<ScrollViewer>
<StackPanel Style="{StaticResource PageRoot}">
<Grid>
@@ -16,8 +22,10 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:TextBlock Grid.Column="0" FontTypography="Title" Text="{x:Static vm:GamesViewModel.Header}" />
<ui:TextBlock Grid.Column="0" FontTypography="Title" Text="{Binding ViewModel.HeaderText}" />
<ui:TextBox Grid.Column="1" MinWidth="220" Margin="0,0,12,0" VerticalAlignment="Center"
AutomationProperties.Name="{x:Static vm:GamesViewModel.SearchPlaceholder}"
Icon="{ui:SymbolIcon Search24}"
@@ -29,7 +37,21 @@
ItemsSource="{x:Static vm:GamesViewModel.Sorts}"
SelectedValue="{Binding ViewModel.Sort, Mode=TwoWay}"
SelectedValuePath="Value" />
<ui:Button Grid.Column="3" Appearance="Primary" VerticalAlignment="Center"
<!-- The view switch: the one button shown is the other view. -->
<StackPanel Grid.Column="3" Margin="0,0,8,0" VerticalAlignment="Center" Orientation="Horizontal">
<ui:Button Appearance="Secondary" Command="{Binding ViewModel.ShowListCommand}" Icon="{ui:SymbolIcon AppsList24}"
ToolTip="{x:Static vm:GamesViewModel.ListText}" AutomationProperties.Name="{x:Static vm:GamesViewModel.ListText}"
Visibility="{Binding ViewModel.ListView, Converter={StaticResource InverseBoolToVis}}" />
<ui:Button Appearance="Secondary" Command="{Binding ViewModel.ShowGridCommand}" Icon="{ui:SymbolIcon Grid24}"
ToolTip="{x:Static vm:GamesViewModel.GridText}" AutomationProperties.Name="{x:Static vm:GamesViewModel.GridText}"
Visibility="{Binding ViewModel.ListView, Converter={StaticResource BoolToVis}}" />
</StackPanel>
<ui:Button Grid.Column="4" Margin="0,0,12,0" Appearance="Secondary" VerticalAlignment="Center"
Command="{Binding ViewModel.RefreshCommand}"
Content="{x:Static vm:GamesViewModel.RefreshText}"
ToolTip="{x:Static vm:GamesViewModel.RefreshToolTip}"
Icon="{ui:SymbolIcon ArrowClockwise24}" />
<ui:Button Grid.Column="5" Appearance="Primary" VerticalAlignment="Center"
Command="{Binding ViewModel.AddGameCommand}"
Content="{x:Static vm:GamesViewModel.AddText}"
Icon="{ui:SymbolIcon Add24}" />
@@ -42,34 +64,42 @@
Text="{x:Static vm:GamesViewModel.NoMatchText}"
Visibility="{Binding ViewModel.NoMatch, Converter={StaticResource BoolToVis}}" />
<ItemsControl Margin="0,16,0,0" ItemsSource="{Binding ViewModel.Games}">
<!-- The grid: as many columns as fit at 300 px or wider, each card an equal share of the width. -->
<ItemsControl x:Name="CardGrid" Margin="0,16,0,0" ItemsSource="{Binding ViewModel.Games}"
Visibility="{Binding ViewModel.ListView, Converter={StaticResource InverseBoolToVis}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
<controls:UniformWrapPanel MinItemWidth="300" Spacing="12" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type vm:GameCardViewModel}">
<ui:CardAction Width="300" Margin="0,0,12,12" IsChevronVisible="False"
<ui:CardAction IsChevronVisible="False" VerticalAlignment="Stretch" VerticalContentAlignment="Top"
Command="{Binding DataContext.ViewModel.OpenCommand, RelativeSource={RelativeSource AncestorType=Page}}"
CommandParameter="{Binding}"
Icon="{ui:SymbolIcon Games24}">
<StackPanel>
<ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" TextTrimming="CharacterEllipsis" />
<StackPanel Orientation="Horizontal" Margin="0,4,0,0">
<Border Style="{StaticResource TagPill}" Margin="0,0,6,0"
<!-- Pills wrap to a second line rather than being cut (the third one was, at 300 px). -->
<WrapPanel Margin="0,4,0,0">
<Border Style="{StaticResource TagPill}" Margin="0,0,6,4"
Visibility="{Binding HasPlatform, Converter={StaticResource BoolToVis}}">
<TextBlock Style="{StaticResource TagPillText}" Text="{Binding PlatformText}" />
</Border>
<Border Style="{StaticResource TagPill}" Margin="0,0,6,0"
<Border Style="{StaticResource TagPill}" Margin="0,0,6,4"
Visibility="{Binding HasEngine, Converter={StaticResource BoolToVis}}">
<TextBlock Style="{StaticResource TagPillText}" Text="{Binding EngineText}" />
</Border>
<Border Style="{StaticResource HookStatePill}">
<Border Style="{StaticResource HookStatePill}" Margin="0,0,6,4">
<TextBlock Style="{StaticResource HookStatePillText}" Text="{Binding HookText}" />
</Border>
</StackPanel>
<ui:TextBlock Margin="0,6,0,0" Appearance="Secondary" Text="{Binding SessionsText}" />
<Border x:Name="NotInstalledPill" Style="{StaticResource TagPill}" Margin="0,0,6,4"
ToolTip="{Binding NotInstalledToolTip}"
Visibility="{Binding NotInstalled, Converter={StaticResource BoolToVis}}">
<TextBlock Style="{StaticResource TagPillText}" Text="{x:Static res:Strings.Games_Card_NotInstalled}" />
</Border>
</WrapPanel>
<ui:TextBlock Margin="0,2,0,0" Appearance="Secondary" Text="{Binding SessionsText}" />
<ui:TextBlock Appearance="Secondary" Text="{Binding PlaytimeText}" />
<ui:TextBlock Appearance="Secondary" Text="{Binding LastPlayedText}" />
</StackPanel>
@@ -77,6 +107,29 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- The list: one row per game across the width; double-click or Enter opens it. -->
<DataGrid x:Name="GameList" Margin="0,16,0,0" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False"
CanUserSortColumns="False" HeadersVisibility="Column" IsReadOnly="True" SelectionMode="Single"
ItemsSource="{Binding ViewModel.Games}"
MouseDoubleClick="OnListDoubleClick" KeyDown="OnListKeyDown"
Visibility="{Binding ViewModel.ListView, Converter={StaticResource BoolToVis}}">
<DataGrid.Columns>
<DataGridTextColumn Header="{x:Static res:Strings.Games_List_Name}" Binding="{Binding Name}" Width="3*" />
<DataGridTextColumn Header="{x:Static res:Strings.Games_List_Store}" Binding="{Binding PlatformText}" Width="Auto" />
<DataGridTextColumn Header="{x:Static res:Strings.Games_List_Engine}" Binding="{Binding EngineText}" Width="*" />
<DataGridTemplateColumn Header="{x:Static res:Strings.Games_List_Status}" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="4,0" VerticalAlignment="Center" Text="{Binding StatusText}" ToolTip="{Binding NotInstalledToolTip}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{x:Static res:Strings.Games_List_Sessions}" Binding="{Binding SessionCount}" Width="Auto" />
<DataGridTextColumn Header="{x:Static res:Strings.Games_List_Played}" Binding="{Binding PlaytimeValue}" Width="Auto" />
<DataGridTextColumn Header="{x:Static res:Strings.Games_List_LastPlayed}" Binding="{Binding LastPlayedValue}" Width="Auto" />
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</ScrollViewer>
</Page>
@@ -1,4 +1,5 @@
using System.Windows;
using System.Windows.Input;
using FrameLedger.App.ViewModels;
using Wpf.Ui.Abstractions.Controls;
@@ -11,6 +12,9 @@ public partial class GamesPage : INavigableView<GamesViewModel>
ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel));
DataContext = this;
InitializeComponent();
// beta.11: the page reloads itself while it is on screen (a session ends, an import adds games), and lets go after.
Loaded += (_, _) => ViewModel.Attach();
Unloaded += (_, _) => ViewModel.Detach();
}
public GamesViewModel ViewModel { get; }
@@ -23,4 +27,25 @@ public partial class GamesPage : INavigableView<GamesViewModel>
_ = ViewModel.DropAsync(paths);
}
}
/// <summary>The list view opens a game on a double-click, as the cards do on a click.</summary>
private void OnListDoubleClick(object sender, MouseButtonEventArgs e) => OpenSelected();
/// <summary>…and on Enter, so the list is usable from the keyboard.</summary>
private void OnListKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
OpenSelected();
e.Handled = true;
}
}
private void OpenSelected()
{
if (GameList.SelectedItem is GameCardViewModel card)
{
ViewModel.OpenCommand.Execute(card);
}
}
}
@@ -8,7 +8,8 @@ namespace FrameLedger.App.Services;
/// <summary>
/// File ▸ Import library… (FR-1.2, P4 PR-4): discover every installed store's titles, show the review checklist,
/// add what the user ticked — hooking off for every one, as File ▸ Add game… would — and land on the Games page.
/// Nothing is launched, nothing is fetched, nothing is added without a tick.
/// Nothing is launched, nothing is fetched, nothing is added without a tick. Since beta.11 the Games page's Refresh runs
/// it for new games only: when every title found is already in the library it says so and shows no checklist.
/// </summary>
[SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime; a cached CompositeFormat would pin the first culture")]
public sealed class ImportLibraryFlow
@@ -17,17 +18,22 @@ public sealed class ImportLibraryFlow
private readonly IImportReview _review;
private readonly IMessageStrip _strip;
private readonly IPageNavigator _navigator;
private readonly LibraryChanges? _changes;
public ImportLibraryFlow(LibraryImporter importer, IImportReview review, IMessageStrip strip, IPageNavigator navigator)
public ImportLibraryFlow(LibraryImporter importer, IImportReview review, IMessageStrip strip, IPageNavigator navigator, LibraryChanges? changes = null)
{
_importer = importer ?? throw new ArgumentNullException(nameof(importer));
_review = review ?? throw new ArgumentNullException(nameof(review));
_strip = strip ?? throw new ArgumentNullException(nameof(strip));
_navigator = navigator ?? throw new ArgumentNullException(nameof(navigator));
_changes = changes;
}
/// <summary>The report, or null when nothing was found or the user cancelled.</summary>
public async Task<ImportReport?> RunAsync(CancellationToken ct = default)
/// <summary>
/// The report, or null when nothing was found or the user cancelled. <paramref name="onlyNew"/> (the Games page's
/// Refresh): when no title found can be imported, say "no new games" and show nothing.
/// </summary>
public async Task<ImportReport?> RunAsync(bool onlyNew = false, CancellationToken ct = default)
{
IReadOnlyList<ImportCandidate> candidates = await _importer.DiscoverAsync(ct).ConfigureAwait(true);
if (candidates.Count == 0)
@@ -36,6 +42,12 @@ public sealed class ImportLibraryFlow
return null;
}
if (onlyNew && !candidates.Any(static c => c.CanImport))
{
_strip.Info(Strings.Import_Title, Strings.Import_NothingNew);
return null;
}
IReadOnlyList<ImportCandidate>? selected = await _review.ReviewAsync(candidates, ct).ConfigureAwait(true);
if (selected is null || selected.Count == 0)
{
@@ -46,6 +58,8 @@ public sealed class ImportLibraryFlow
_strip.Success(Strings.Import_Title, string.Format(CultureInfo.CurrentCulture, Strings.Import_Done_Format, report.Added, report.Skipped));
if (report.Added > 0)
{
// The Games page, if it is the one on screen, does not reload on a navigation to itself: say so to it.
_changes?.Announce();
_navigator.Navigate<GamesPage>();
}
@@ -0,0 +1,16 @@
namespace FrameLedger.App.Services;
/// <summary>
/// The App's own "the library's rows changed" signal (beta.11, owner request 2026-10-03): an import adds entries, and a
/// page already on screen reloads. Navigating to the page that is on screen does nothing in WPF UI 4.3.0, so the Games
/// page never saw an import made from File ▸ Import library… while it was open. The Agent's own changes (a merge, a
/// finding, a new session) reach the page through its session events and the Refresh button.
/// </summary>
public sealed class LibraryChanges
{
/// <summary>Raised on the thread that changed the library — the UI thread for every caller today.</summary>
public event EventHandler? Changed;
/// <summary>Say that entries were added, removed or replaced.</summary>
public void Announce() => Changed?.Invoke(this, EventArgs.Empty);
}
+45
View File
@@ -426,17 +426,30 @@ public static class Strings
nameof(Games_Card_HookOn),
nameof(Games_Card_LastPlayed_Format),
nameof(Games_Card_NeverPlayed),
nameof(Games_Card_NotInstalled),
nameof(Games_Card_NotRecorded),
nameof(Games_Card_Playtime_Format),
nameof(Games_Card_Sessions_Format),
nameof(Games_Empty),
nameof(Games_Header),
nameof(Games_Header_Count_Format),
nameof(Games_List_Engine),
nameof(Games_List_LastPlayed),
nameof(Games_List_Name),
nameof(Games_List_Played),
nameof(Games_List_Sessions),
nameof(Games_List_Status),
nameof(Games_List_Store),
nameof(Games_NoMatch),
nameof(Games_Refresh),
nameof(Games_Refresh_ToolTip),
nameof(Games_Search_Placeholder),
nameof(Games_Sort_Label),
nameof(Games_Sort_LastPlayed),
nameof(Games_Sort_Name),
nameof(Games_Sort_Playtime),
nameof(Games_View_Grid),
nameof(Games_View_List),
nameof(Guard_ConsentMissing),
nameof(Guard_DriverScanFailed),
nameof(Guard_HookNotEnabled),
@@ -471,9 +484,11 @@ public static class Strings
nameof(Import_Note_Moved),
nameof(Import_Note_NoExe),
nameof(Import_NothingFound),
nameof(Import_NothingNew),
nameof(Import_SelectAll),
nameof(Import_Selected_Format),
nameof(Import_SelectNone),
nameof(Import_ShowExisting_Format),
nameof(Import_Title),
nameof(Latency_Avg),
nameof(Latency_Axis),
@@ -1685,6 +1700,8 @@ public static class Strings
public static string Games_Card_NeverPlayed => ResourceManager.GetString(nameof(Games_Card_NeverPlayed), Culture) ?? nameof(Games_Card_NeverPlayed);
public static string Games_Card_NotInstalled => ResourceManager.GetString(nameof(Games_Card_NotInstalled), Culture) ?? nameof(Games_Card_NotInstalled);
public static string Games_Card_NotRecorded => ResourceManager.GetString(nameof(Games_Card_NotRecorded), Culture) ?? nameof(Games_Card_NotRecorded);
public static string Games_Card_Playtime_Format => ResourceManager.GetString(nameof(Games_Card_Playtime_Format), Culture) ?? nameof(Games_Card_Playtime_Format);
@@ -1695,8 +1712,28 @@ public static class Strings
public static string Games_Header => ResourceManager.GetString(nameof(Games_Header), Culture) ?? nameof(Games_Header);
public static string Games_Header_Count_Format => ResourceManager.GetString(nameof(Games_Header_Count_Format), Culture) ?? nameof(Games_Header_Count_Format);
public static string Games_List_Engine => ResourceManager.GetString(nameof(Games_List_Engine), Culture) ?? nameof(Games_List_Engine);
public static string Games_List_LastPlayed => ResourceManager.GetString(nameof(Games_List_LastPlayed), Culture) ?? nameof(Games_List_LastPlayed);
public static string Games_List_Name => ResourceManager.GetString(nameof(Games_List_Name), Culture) ?? nameof(Games_List_Name);
public static string Games_List_Played => ResourceManager.GetString(nameof(Games_List_Played), Culture) ?? nameof(Games_List_Played);
public static string Games_List_Sessions => ResourceManager.GetString(nameof(Games_List_Sessions), Culture) ?? nameof(Games_List_Sessions);
public static string Games_List_Status => ResourceManager.GetString(nameof(Games_List_Status), Culture) ?? nameof(Games_List_Status);
public static string Games_List_Store => ResourceManager.GetString(nameof(Games_List_Store), Culture) ?? nameof(Games_List_Store);
public static string Games_NoMatch => ResourceManager.GetString(nameof(Games_NoMatch), Culture) ?? nameof(Games_NoMatch);
public static string Games_Refresh => ResourceManager.GetString(nameof(Games_Refresh), Culture) ?? nameof(Games_Refresh);
public static string Games_Refresh_ToolTip => ResourceManager.GetString(nameof(Games_Refresh_ToolTip), Culture) ?? nameof(Games_Refresh_ToolTip);
public static string Games_Search_Placeholder => ResourceManager.GetString(nameof(Games_Search_Placeholder), Culture) ?? nameof(Games_Search_Placeholder);
public static string Games_Sort_Label => ResourceManager.GetString(nameof(Games_Sort_Label), Culture) ?? nameof(Games_Sort_Label);
@@ -1707,6 +1744,10 @@ public static class Strings
public static string Games_Sort_Playtime => ResourceManager.GetString(nameof(Games_Sort_Playtime), Culture) ?? nameof(Games_Sort_Playtime);
public static string Games_View_Grid => ResourceManager.GetString(nameof(Games_View_Grid), Culture) ?? nameof(Games_View_Grid);
public static string Games_View_List => ResourceManager.GetString(nameof(Games_View_List), Culture) ?? nameof(Games_View_List);
public static string Guard_ConsentMissing => ResourceManager.GetString(nameof(Guard_ConsentMissing), Culture) ?? nameof(Guard_ConsentMissing);
public static string Guard_DriverScanFailed => ResourceManager.GetString(nameof(Guard_DriverScanFailed), Culture) ?? nameof(Guard_DriverScanFailed);
@@ -1775,12 +1816,16 @@ public static class Strings
public static string Import_NothingFound => ResourceManager.GetString(nameof(Import_NothingFound), Culture) ?? nameof(Import_NothingFound);
public static string Import_NothingNew => ResourceManager.GetString(nameof(Import_NothingNew), Culture) ?? nameof(Import_NothingNew);
public static string Import_SelectAll => ResourceManager.GetString(nameof(Import_SelectAll), Culture) ?? nameof(Import_SelectAll);
public static string Import_Selected_Format => ResourceManager.GetString(nameof(Import_Selected_Format), Culture) ?? nameof(Import_Selected_Format);
public static string Import_SelectNone => ResourceManager.GetString(nameof(Import_SelectNone), Culture) ?? nameof(Import_SelectNone);
public static string Import_ShowExisting_Format => ResourceManager.GetString(nameof(Import_ShowExisting_Format), Culture) ?? nameof(Import_ShowExisting_Format);
public static string Import_Title => ResourceManager.GetString(nameof(Import_Title), Culture) ?? nameof(Import_Title);
public static string Latency_Avg => ResourceManager.GetString(nameof(Latency_Avg), Culture) ?? nameof(Latency_Avg);
+60
View File
@@ -145,6 +145,10 @@
<value>ゲーム</value>
<comment>review</comment>
</data>
<data name="Games_Header_Count_Format" xml:space="preserve">
<value>ゲーム · {0}</value>
<comment>review</comment>
</data>
<data name="Logs_Empty" xml:space="preserve">
<value>このソースのログファイルはまだありません。</value>
<comment>review</comment>
@@ -289,6 +293,14 @@
<value>このマシンの Steam、GOG Galaxy、Epic、itch.io にインストール済みのゲームは見つかりませんでした。</value>
<comment>review</comment>
</data>
<data name="Import_NothingNew" xml:space="preserve">
<value>新しいゲームはありません。ストアにインストールされているゲームはすべてライブラリーにあります。</value>
<comment>review</comment>
</data>
<data name="Import_ShowExisting_Format" xml:space="preserve">
<value>ライブラリーにある {0} 件のゲームを表示する</value>
<comment>review</comment>
</data>
<data name="Import_Done_Format" xml:space="preserve">
<value>{0} 件のゲームをフック無効で追加しました。{1} 件はそのままです。</value>
<comment>review</comment>
@@ -977,10 +989,58 @@
<value>ゲームを追加…</value>
<comment>review</comment>
</data>
<data name="Games_Refresh" xml:space="preserve">
<value>更新</value>
<comment>review</comment>
</data>
<data name="Games_Refresh_ToolTip" xml:space="preserve">
<value>ライブラリーを読み直し、その後にインストールされたゲームをストアから探し、実行ファイルがなくなったゲームに印を付けます</value>
<comment>review</comment>
</data>
<data name="Games_View_Grid" xml:space="preserve">
<value>グリッドで表示</value>
<comment>review</comment>
</data>
<data name="Games_View_List" xml:space="preserve">
<value>リストで表示</value>
<comment>review</comment>
</data>
<data name="Games_List_Name" xml:space="preserve">
<value>名前</value>
<comment>review</comment>
</data>
<data name="Games_List_Store" xml:space="preserve">
<value>ストア</value>
<comment>review</comment>
</data>
<data name="Games_List_Engine" xml:space="preserve">
<value>エンジン</value>
<comment>review</comment>
</data>
<data name="Games_List_Status" xml:space="preserve">
<value>状態</value>
<comment>review</comment>
</data>
<data name="Games_List_Sessions" xml:space="preserve">
<value>セッション</value>
<comment>review</comment>
</data>
<data name="Games_List_Played" xml:space="preserve">
<value>プレイ時間</value>
<comment>review</comment>
</data>
<data name="Games_List_LastPlayed" xml:space="preserve">
<value>最終プレイ</value>
<comment>review</comment>
</data>
<data name="Games_Card_NotRecorded" xml:space="preserve">
<value>記録しない</value>
<comment>review</comment>
</data>
<data name="Games_Card_NotInstalled" xml:space="preserve">
<value>未インストール</value>
<comment>review</comment>
</data>
<data name="Games_Card_HookOff" xml:space="preserve">
<value>フック無効</value>
<comment>review</comment>
+45
View File
@@ -114,6 +114,9 @@
<data name="Games_Header" xml:space="preserve">
<value>Games</value>
</data>
<data name="Games_Header_Count_Format" xml:space="preserve">
<value>Games · {0}</value>
</data>
<data name="Logs_Empty" xml:space="preserve">
<value>No log file yet for this source.</value>
</data>
@@ -222,6 +225,12 @@
<data name="Import_NothingFound" xml:space="preserve">
<value>No installed games were found in Steam, GOG Galaxy, Epic or itch.io on this machine.</value>
</data>
<data name="Import_NothingNew" xml:space="preserve">
<value>No new games: every game your stores have installed is already in the library.</value>
</data>
<data name="Import_ShowExisting_Format" xml:space="preserve">
<value>Show the {0} games already in the library</value>
</data>
<data name="Import_Done_Format" xml:space="preserve">
<value>{0} game(s) added with hooking off; {1} left as they were.</value>
</data>
@@ -738,9 +747,45 @@
<data name="Games_Add" xml:space="preserve">
<value>Add game…</value>
</data>
<data name="Games_Refresh" xml:space="preserve">
<value>Refresh</value>
</data>
<data name="Games_Refresh_ToolTip" xml:space="preserve">
<value>Read the library again, look in your stores for games installed since, and mark games whose executable is gone</value>
</data>
<data name="Games_View_Grid" xml:space="preserve">
<value>Show as a grid</value>
</data>
<data name="Games_View_List" xml:space="preserve">
<value>Show as a list</value>
</data>
<data name="Games_List_Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="Games_List_Store" xml:space="preserve">
<value>Store</value>
</data>
<data name="Games_List_Engine" xml:space="preserve">
<value>Engine</value>
</data>
<data name="Games_List_Status" xml:space="preserve">
<value>Status</value>
</data>
<data name="Games_List_Sessions" xml:space="preserve">
<value>Sessions</value>
</data>
<data name="Games_List_Played" xml:space="preserve">
<value>Played</value>
</data>
<data name="Games_List_LastPlayed" xml:space="preserve">
<value>Last played</value>
</data>
<data name="Games_Card_NotRecorded" xml:space="preserve">
<value>Not recorded</value>
</data>
<data name="Games_Card_NotInstalled" xml:space="preserve">
<value>Not installed</value>
</data>
<data name="Games_Card_HookOff" xml:space="preserve">
<value>Hooking off</value>
</data>
+45
View File
@@ -109,6 +109,9 @@
<data name="Games_Header" xml:space="preserve">
<value>Game</value>
</data>
<data name="Games_Header_Count_Format" xml:space="preserve">
<value>Game · {0}</value>
</data>
<data name="Logs_Empty" xml:space="preserve">
<value>Chưa có tệp nhật ký cho nguồn này.</value>
</data>
@@ -217,6 +220,12 @@
<data name="Import_NothingFound" xml:space="preserve">
<value>Không tìm thấy game nào đã cài trong Steam, GOG Galaxy, Epic hay itch.io trên máy này.</value>
</data>
<data name="Import_NothingNew" xml:space="preserve">
<value>Không có game mới: mọi game các store đã cài đều đã có trong thư viện.</value>
</data>
<data name="Import_ShowExisting_Format" xml:space="preserve">
<value>Hiện {0} game đã có trong thư viện</value>
</data>
<data name="Import_Done_Format" xml:space="preserve">
<value>Đã thêm {0} game với hooking tắt; {1} giữ nguyên.</value>
</data>
@@ -733,9 +742,45 @@
<data name="Games_Add" xml:space="preserve">
<value>Thêm game…</value>
</data>
<data name="Games_Refresh" xml:space="preserve">
<value>Làm mới</value>
</data>
<data name="Games_Refresh_ToolTip" xml:space="preserve">
<value>Đọc lại thư viện, tìm trong các store những game mới cài, và đánh dấu game không còn file chạy</value>
</data>
<data name="Games_View_Grid" xml:space="preserve">
<value>Hiển thị dạng lưới</value>
</data>
<data name="Games_View_List" xml:space="preserve">
<value>Hiển thị dạng danh sách</value>
</data>
<data name="Games_List_Name" xml:space="preserve">
<value>Tên</value>
</data>
<data name="Games_List_Store" xml:space="preserve">
<value>Store</value>
</data>
<data name="Games_List_Engine" xml:space="preserve">
<value>Engine</value>
</data>
<data name="Games_List_Status" xml:space="preserve">
<value>Trạng thái</value>
</data>
<data name="Games_List_Sessions" xml:space="preserve">
<value>Phiên</value>
</data>
<data name="Games_List_Played" xml:space="preserve">
<value>Đã chơi</value>
</data>
<data name="Games_List_LastPlayed" xml:space="preserve">
<value>Chơi lần cuối</value>
</data>
<data name="Games_Card_NotRecorded" xml:space="preserve">
<value>Không ghi</value>
</data>
<data name="Games_Card_NotInstalled" xml:space="preserve">
<value>Chưa cài</value>
</data>
<data name="Games_Card_HookOff" xml:space="preserve">
<value>Hooking tắt</value>
</data>
@@ -5,17 +5,21 @@ using FrameLedger.App.Services;
namespace FrameLedger.App.ViewModels;
/// <summary>
/// One library card (<c>08_UI</c> §Games): name, platform and engine badges, playtime, last played, hooking state — or, since
/// 2026-09-23, "Not recorded" in its place for an entry whose recording is off, and since 2026-09-25 "Anti-cheat" for one
/// the guard found anti-cheat in. The sparkline is PR-6's.
/// One library entry (<c>08_UI</c> §Games), as a card in the grid or a row in the list: name, platform and engine badges,
/// playtime, last played, hooking state — or, since 2026-09-23, "Not recorded" in its place for an entry whose recording is
/// off, and since 2026-09-25 "Anti-cheat" for one the guard found anti-cheat in; since beta.11 "Not installed" beside it
/// when its executable is not on disk (<see cref="GameLibrary.ExecutableExists"/>, read when the library is listed, never
/// stored), with the game page's own words for why (<see cref="Formats.ExecutableMissingText"/>).
/// </summary>
[SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime")]
public sealed class GameCardViewModel
{
public GameCardViewModel(GameCard card)
public GameCardViewModel(GameCard card, bool installed = true)
{
ArgumentNullException.ThrowIfNull(card);
Card = card;
NotInstalled = !installed;
NotInstalledToolTip = installed ? null : Formats.ExecutableMissingText(card.Row.Fingerprint.ExePath);
Id = card.Row.Id;
Name = card.Row.Name;
PlatformText = Formats.Platform(card.Row.Platform);
@@ -36,7 +40,9 @@ public sealed class GameCardViewModel
TotalSeconds = card.Summary?.TotalSeconds ?? 0;
LastPlayedAt = card.Summary?.LastPlayedAt;
SessionsText = string.Format(CultureInfo.CurrentCulture, Strings.Games_Card_Sessions_Format, SessionCount);
PlaytimeText = string.Format(CultureInfo.CurrentCulture, Strings.Games_Card_Playtime_Format, Formats.Playtime(TotalSeconds));
PlaytimeValue = Formats.Playtime(TotalSeconds);
PlaytimeText = string.Format(CultureInfo.CurrentCulture, Strings.Games_Card_Playtime_Format, PlaytimeValue);
LastPlayedValue = LastPlayedAt is DateTimeOffset when ? Formats.Date(when) : Strings.Games_Card_NeverPlayed;
LastPlayedText = LastPlayedAt is DateTimeOffset at
? string.Format(CultureInfo.CurrentCulture, Strings.Games_Card_LastPlayed_Format, Formats.Date(at))
: Strings.Games_Card_NeverPlayed;
@@ -83,4 +89,19 @@ public sealed class GameCardViewModel
public string PlaytimeText { get; }
public string LastPlayedText { get; }
/// <summary>The list view's playtime cell: the duration alone.</summary>
public string PlaytimeValue { get; }
/// <summary>The list view's last-played cell: the date alone, or "not played yet".</summary>
public string LastPlayedValue { get; }
/// <summary>beta.11: the "Not installed" pill shows — the file, or the drive it was on, is not there now.</summary>
public bool NotInstalled { get; }
/// <summary>What the pill means here — the drive that is not connected, or the path the file is gone from; null when installed.</summary>
public string? NotInstalledToolTip { get; }
/// <summary>The list view's status cell: what the hook pill says, and "Not installed" after it when that is so.</summary>
public string StatusText => NotInstalled ? HookText + " · " + Strings.Games_Card_NotInstalled : HookText;
}
@@ -1,19 +1,39 @@
using System.Collections.ObjectModel;
using System.Globalization;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using FrameLedger.App.Pages;
using FrameLedger.App.Services;
using FrameLedger.Application.Settings;
using FrameLedger.Shared.Ipc;
namespace FrameLedger.App.ViewModels;
/// <summary>The Games grid (<c>08_UI</c> §Games): every game in the library as a card, searched and sorted in memory; add by pick or drop; open by click.</summary>
/// <summary>
/// The Games library (<c>08_UI</c> §Games): every game in the library, searched and sorted in memory; add by pick or drop;
/// open by click. Since beta.11 (owner requests 2026-10-03): shown as a grid of cards that fills the width or as a list
/// (<c>ui.library_view</c>), with the count in the header; <b>Refresh</b> reloads the library, looks in the stores for games
/// installed since and offers only those, and marks entries whose executable is gone ("Not installed"); and the page
/// reloads by itself when a session ends or an import adds games while it is on screen.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime")]
public sealed partial class GamesViewModel : ObservableObject
{
private const string _listValue = "list";
private const string _gridValue = "grid";
private readonly GameLibrary _library;
private readonly GameSelection _selection;
private readonly IPageNavigator _navigator;
private readonly AddGameFlow _addGame;
private readonly ImportLibraryFlow? _import;
private readonly RegisteredSettings? _settings;
private readonly IAgentLink? _agent;
private readonly LibraryChanges? _changes;
private readonly UiThread _ui = new();
private IReadOnlyList<GameCardViewModel> _all = [];
private bool _viewRead;
private bool _attached;
[ObservableProperty]
private string _search = string.Empty;
@@ -27,17 +47,27 @@ public sealed partial class GamesViewModel : ObservableObject
[ObservableProperty]
private bool _noMatch;
public GamesViewModel(GameLibrary library, GameSelection selection, IPageNavigator navigator, AddGameFlow addGame)
[ObservableProperty]
private string _headerText = Strings.Games_Header;
/// <summary>The list instead of the grid (<c>ui.library_view</c>); remembered when the user changes it.</summary>
[ObservableProperty]
private bool _listView;
public GamesViewModel(GameLibrary library, GameSelection selection, IPageNavigator navigator, AddGameFlow addGame, ImportLibraryFlow? import = null,
RegisteredSettings? settings = null, IAgentLink? agent = null, LibraryChanges? changes = null)
{
_library = library ?? throw new ArgumentNullException(nameof(library));
_selection = selection ?? throw new ArgumentNullException(nameof(selection));
_navigator = navigator ?? throw new ArgumentNullException(nameof(navigator));
_addGame = addGame ?? throw new ArgumentNullException(nameof(addGame));
_import = import;
_settings = settings;
_agent = agent;
_changes = changes;
Pending = LoadAsync();
}
public static string Header => Strings.Games_Header;
public static string EmptyText => Strings.Games_Empty;
public static string NoMatchText => Strings.Games_NoMatch;
@@ -48,6 +78,14 @@ public sealed partial class GamesViewModel : ObservableObject
public static string SortLabel => Strings.Games_Sort_Label;
public static string RefreshText => Strings.Games_Refresh;
public static string RefreshToolTip => Strings.Games_Refresh_ToolTip;
public static string GridText => Strings.Games_View_Grid;
public static string ListText => Strings.Games_View_List;
public static IReadOnlyList<Choice<GamesSort>> Sorts { get; } =
[
new(GamesSort.Name, Strings.Games_Sort_Name),
@@ -62,11 +100,85 @@ public sealed partial class GamesViewModel : ObservableObject
public async Task LoadAsync(CancellationToken ct = default)
{
await ReadViewAsync(ct).ConfigureAwait(true);
IReadOnlyList<GameCard> cards = await _library.ListCardsAsync(ct).ConfigureAwait(true);
_all = [.. cards.Select(static c => new GameCardViewModel(c))];
// Whether each executable is on disk is a file-system question per entry — a drive that is gone can take a moment
// to say so — so it is asked off the UI thread, the game page's own way (GameLibrary.ExecutableExists).
bool[] installed = await Task.Run(() => cards.Select(static c => GameLibrary.ExecutableExists(c.Row.Fingerprint.ExePath)).ToArray(), ct)
.ConfigureAwait(true);
_all = [.. cards.Select((c, i) => new GameCardViewModel(c, installed[i]))];
HeaderText = string.Format(CultureInfo.CurrentCulture, Strings.Games_Header_Count_Format, _all.Count);
Apply();
}
/// <summary>
/// Listens while the page is on screen: a session that ends changes a card's count, playtime and last played, and an
/// import made from the menu adds cards. The page calls it on Loaded and <see cref="Detach"/> on Unloaded; the link and
/// the notifier are singletons and must not hold the page.
/// </summary>
public void Attach()
{
if (_attached)
{
return;
}
if (_agent is not null)
{
_agent.EventReceived += OnAgentEvent;
}
if (_changes is not null)
{
_changes.Changed += OnLibraryChanged;
}
_attached = true;
}
public void Detach()
{
if (!_attached)
{
return;
}
if (_agent is not null)
{
_agent.EventReceived -= OnAgentEvent;
}
if (_changes is not null)
{
_changes.Changed -= OnLibraryChanged;
}
_attached = false;
}
/// <summary>
/// beta.11: the library read again, then the stores asked for games installed since — offered in the import checklist,
/// the games already in the library hidden — and read again when any was added. A game whose executable is gone is
/// marked on its card by the read; nothing is removed.
/// </summary>
[RelayCommand]
private async Task RefreshAsync()
{
Pending = LoadAsync();
await Pending.ConfigureAwait(true);
if (_import is not null && await _import.RunAsync(onlyNew: true).ConfigureAwait(true) is { Added: > 0 })
{
Pending = LoadAsync();
await Pending.ConfigureAwait(true);
}
}
[RelayCommand]
private void ShowGrid() => ListView = false;
[RelayCommand]
private void ShowList() => ListView = true;
[RelayCommand]
private async Task AddGameAsync() => _ = await _addGame.RunAsync().ConfigureAwait(true);
@@ -96,6 +208,43 @@ public sealed partial class GamesViewModel : ObservableObject
partial void OnSortChanged(GamesSort value) => Apply();
partial void OnListViewChanged(bool value)
{
if (_viewRead && _settings is not null)
{
_ = SaveViewAsync(value);
}
}
private async Task SaveViewAsync(bool list) =>
await _settings!.SetAsync(SettingsRegistry.UiLibraryView, list ? _listValue : _gridValue).ConfigureAwait(true);
/// <summary>The remembered view, read once per page before the first list — so reading it is not taken for a change.</summary>
private async Task ReadViewAsync(CancellationToken ct)
{
if (_viewRead)
{
return;
}
if (_settings is not null)
{
ListView = string.Equals(await _settings.GetAsync(SettingsRegistry.UiLibraryView, ct).ConfigureAwait(true), _listValue, StringComparison.Ordinal);
}
_viewRead = true;
}
private void OnAgentEvent(object? sender, AgentEventArgs e) => _ui.Post(() =>
{
if (string.Equals(e.Envelope.Type, IpcMessageType.SessionCompleted, StringComparison.Ordinal))
{
Pending = LoadAsync();
}
});
private void OnLibraryChanged(object? sender, EventArgs e) => _ui.Post(() => Pending = LoadAsync());
private void Apply()
{
IEnumerable<GameCardViewModel> shown = _all;
@@ -25,6 +25,12 @@ public sealed partial class ImportCandidateViewModel : ObservableObject
public bool CanImport => Candidate.CanImport;
/// <summary>
/// Already in the library — at this path, or (since 2026-09-23) the same file under another drive letter. Since beta.11
/// such a row is hidden unless the user asks to see it, and then shown dimmed with a box that cannot be ticked.
/// </summary>
public bool IsExisting => Candidate.AlreadyInLibrary || Candidate.MovedFrom is not null;
public string PlatformText => Formats.Platform(Candidate.Game.Platform);
public string Name => Candidate.Game.Name;
@@ -8,7 +8,12 @@ using FrameLedger.Application.Import;
namespace FrameLedger.App.ViewModels;
/// <summary>FR-1.2's review checklist: every candidate the stores found, ticked by default where it can be imported; the count follows the ticks.</summary>
/// <summary>
/// FR-1.2's review checklist: every candidate the stores found, ticked by default where it can be imported; the count
/// follows the ticks. Since beta.11 (owner request 2026-10-03) the games already in the library are hidden by default —
/// on a re-import they were most of the list and pushed the new ones out of sight — and <see cref="ShowExisting"/> brings
/// them back, dimmed, their boxes disabled.
/// </summary>
[SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime; a cached CompositeFormat would pin the first culture")]
public sealed partial class ImportReviewViewModel : ObservableObject
{
@@ -17,6 +22,9 @@ public sealed partial class ImportReviewViewModel : ObservableObject
[NotifyPropertyChangedFor(nameof(SelectedText))]
private int _selectedCount;
[ObservableProperty]
private bool _showExisting;
public ImportReviewViewModel(IReadOnlyList<ImportCandidate> candidates)
{
ArgumentNullException.ThrowIfNull(candidates);
@@ -27,11 +35,25 @@ public sealed partial class ImportReviewViewModel : ObservableObject
Rows.Add(row);
}
ExistingCount = Rows.Count(static r => r.IsExisting);
ShowExistingText = string.Format(CultureInfo.CurrentCulture, Strings.Import_ShowExisting_Format, ExistingCount);
Refilter();
Recount();
}
/// <summary>Every candidate, shown or not.</summary>
public ObservableCollection<ImportCandidateViewModel> Rows { get; } = [];
/// <summary>What the checklist shows: every row, less those already in the library unless <see cref="ShowExisting"/>.</summary>
public ObservableCollection<ImportCandidateViewModel> Shown { get; } = [];
/// <summary>Rows already in the library (at this path or another drive letter).</summary>
public int ExistingCount { get; }
public bool HasExisting => ExistingCount > 0;
public string ShowExistingText { get; }
public static string Title => Strings.Import_Title;
public static string Intro => Strings.Import_Intro;
@@ -77,4 +99,15 @@ public sealed partial class ImportReviewViewModel : ObservableObject
}
private void Recount() => SelectedCount = Rows.Count(static r => r.IsSelected && r.CanImport);
partial void OnShowExistingChanged(bool value) => Refilter();
private void Refilter()
{
Shown.Clear();
foreach (ImportCandidateViewModel r in Rows.Where(r => ShowExisting || !r.IsExisting))
{
Shown.Add(r);
}
}
}
@@ -63,6 +63,18 @@ public static class SettingsRegistry
Default = "0",
};
/// <summary>
/// How the Games library is shown (beta.11, owner request 2026-10-03): a grid of cards that fills the width, or a list.
/// The page's own switch writes it; Settings has no row for it.
/// </summary>
public static readonly SettingDefinition UiLibraryView = new()
{
Key = "ui.library_view",
Kind = SettingKind.Choice,
Default = "grid",
Choices = ["grid", "list"],
};
/// <summary>Whether the Agent's watcher records tracked games that the App did not launch (FR-3.1/FR-3.3).</summary>
public static readonly SettingDefinition CaptureBackground = new()
{
@@ -178,7 +190,7 @@ public static class SettingsRegistry
/// <summary>Every definition, in the order <c>06_DATA_MODEL</c> lists them.</summary>
public static IReadOnlyList<SettingDefinition> All { get; } =
[
UiLanguage, UiTheme, UiStartWithWindows, UiMinimizeToTray, UiHideAntiCheatHooking, UiFpsDecimals,
UiLanguage, UiTheme, UiStartWithWindows, UiMinimizeToTray, UiHideAntiCheatHooking, UiFpsDecimals, UiLibraryView,
CaptureBackground, HookingKillSwitch, HookingUserModeExceptions, CaptureRunElevated, CaptureMinSessionSeconds, TelemetryIntervalMs, RetentionRawSessionsPerGame,
UpdateChannel, UpdateAutoCheck, PrivacyOnlineMetadata, LogDebug,
];
@@ -0,0 +1,128 @@
using System.IO;
using FluentAssertions;
using FrameLedger.App.Controls;
using FrameLedger.App.Services;
using FrameLedger.App.ViewModels;
using FrameLedger.Application.Persistence;
using FrameLedger.Shared.Ipc;
namespace FrameLedger.App.Tests;
/// <summary>
/// beta.11 (owner requests 2026-10-03): the library page counts its games, reloads itself while on screen when a session
/// ends or an import adds games, lets go when it leaves, and its grid's columns fill the width.
/// </summary>
public sealed class GamesViewModelTests
{
private static CancellationToken Ct => TestContext.Current.CancellationToken;
private sealed class NoNavigation : IPageNavigator
{
public void Navigate<TPage>()
where TPage : class
{
}
public void GoBack()
{
}
}
private sealed class NoPicker : IGamePicker
{
public string? PickExecutable() => null;
}
private sealed class NoStrip : IMessageStrip
{
public void Info(string title, string body)
{
}
public void Success(string title, string body)
{
}
public void Warn(string title, string body)
{
}
}
[Fact]
public async Task ThePageOnScreenReloadsWhenAnImportAddsGamesOrASessionEndsAndNotAfterItLeaves()
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
GameRow alpha = await s.GameAsync("Alpha");
var selection = new GameSelection();
var nav = new NoNavigation();
var link = new FakeAgentLink();
var changes = new LibraryChanges();
var vm = new GamesViewModel(s.Library, selection, nav, new AddGameFlow(s.Library, new NoPicker(), selection, nav, new NoStrip()), agent: link, changes: changes);
Task loaded = vm.Pending;
await loaded;
vm.HeaderText.Should().EndWith("1");
vm.Attach();
vm.Attach(); // a second Loaded does not subscribe twice
_ = await s.GameAsync("Bravo");
changes.Announce();
Task afterImport = vm.Pending;
await afterImport;
vm.Games.Should().HaveCount(2, "an import made from the menu while the page is on screen");
vm.HeaderText.Should().EndWith("2");
long session = await s.SessionAsync(alpha.Id, DateTimeOffset.UtcNow);
link.Raise(IpcMessageType.SessionCompleted, new SessionCompletedEvent(Guid.NewGuid(), session, "normal", 1, "saved", "exited", alpha.Id, "Alpha"));
Task afterSession = vm.Pending;
await afterSession;
vm.Games.Single(static g => string.Equals(g.Name, "Alpha", StringComparison.Ordinal)).SessionCount.Should().Be(1);
vm.Detach();
Task before = vm.Pending;
_ = await s.GameAsync("Charlie");
changes.Announce();
vm.Pending.Should().BeSameAs(before, "a page that left holds nothing and reloads nothing");
vm.Games.Should().HaveCount(2);
}
[Fact]
public async Task ACardSaysWhetherItsExecutableIsThereAndWhy()
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
GameRow row = await s.GameAsync("Gone", @"Q:\Games\Gone\gone.exe");
new GameCardViewModel(new GameCard(row, null)).NotInstalled.Should().BeFalse("installed unless the listing said otherwise");
var missing = new GameCardViewModel(new GameCard(row, null), installed: false);
missing.NotInstalled.Should().BeTrue();
missing.NotInstalledToolTip.Should().Be(Formats.ExecutableMissingText(@"Q:\Games\Gone\gone.exe"), "the game page's own words for why");
missing.StatusText.Should().Contain(Strings.Games_Card_NotInstalled);
await using ScratchLedger s2 = await ScratchLedger.OpenAsync();
var listed = new GamesViewModel(s2.Library, new GameSelection(), new NoNavigation(),
new AddGameFlow(s2.Library, new NoPicker(), new GameSelection(), new NoNavigation(), new NoStrip()));
string here = typeof(GamesViewModelTests).Assembly.Location;
_ = await s2.GameAsync("Here", here);
_ = await s2.GameAsync("Gone", Path.Combine(AppContext.BaseDirectory, "no-such-game.exe"));
await listed.LoadAsync(Ct);
listed.Games.Single(static g => string.Equals(g.Name, "Here", StringComparison.Ordinal)).NotInstalled.Should().BeFalse();
listed.Games.Single(static g => string.Equals(g.Name, "Gone", StringComparison.Ordinal)).NotInstalled.Should().BeTrue();
}
[Theory]
[InlineData(1200, 3)]
[InlineData(1248, 4)]
[InlineData(1235, 3)]
[InlineData(624, 2)]
[InlineData(250, 1)]
[InlineData(double.PositiveInfinity, 1)]
public void TheGridHasAsManyColumnsAsFitAtTheMinimumWidth(double width, int columns)
{
UniformWrapPanel.ColumnsFor(width, 300, 12).Should().Be(columns);
if (!double.IsInfinity(width))
{
double item = UniformWrapPanel.ItemWidthFor(width, columns, 12);
item.Should().BeGreaterThanOrEqualTo(columns == 1 ? 0 : 300);
((columns * item) + ((columns - 1) * 12)).Should().BeApproximately(width, 0.001, "a row fills the width");
}
}
}
@@ -90,7 +90,7 @@ public sealed class ImportLibraryFlowTests : IDisposable
var importer = new LibraryImporter([store], s.Games, new ExecutableIdentitySource(), new ExecutableLocator(), static _ => { });
var flow = new ImportLibraryFlow(importer, review, strip, nav);
ImportReport? report = await flow.RunAsync(Ct);
ImportReport? report = await flow.RunAsync(ct: Ct);
report.Should().NotBeNull();
report!.Added.Should().Be(1);
@@ -114,17 +114,55 @@ public sealed class ImportLibraryFlowTests : IDisposable
var nav = new FakeNavigator();
var review = new ScriptedReview(static _ => null);
var empty = new ImportLibraryFlow(new LibraryImporter([new ScriptedStore()], s.Games, new ExecutableIdentitySource(), new ExecutableLocator(), static _ => { }), review, strip, nav);
(await empty.RunAsync(Ct)).Should().BeNull();
(await empty.RunAsync(ct: Ct)).Should().BeNull();
strip.Kinds.Should().Equal("info");
review.Shown.Should().BeEmpty("nothing to review");
string exe = await ExeAsync("Game");
var cancelled = new ImportLibraryFlow(new LibraryImporter([new ScriptedStore(new StoreGame("epic", "g", "Game", Path.GetDirectoryName(exe)!, exe, null))], s.Games, new ExecutableIdentitySource(), new ExecutableLocator(), static _ => { }), review, strip, nav);
(await cancelled.RunAsync(Ct)).Should().BeNull();
(await cancelled.RunAsync(ct: Ct)).Should().BeNull();
(await s.Games.ListAsync(Ct)).Should().BeEmpty();
nav.Pages.Should().BeEmpty();
}
/// <summary>
/// beta.11: the Games page's Refresh runs the import for new games only — every title already in the library means "no
/// new games" and no checklist; a new one opens it, and the page on screen is told the library changed.
/// </summary>
[Fact]
public async Task RefreshOffersOnlyNewGamesAndSaysWhenThereAreNone()
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
string old = await ExeAsync("Old");
await s.Games.EnsureAsync(new ExecutableIdentitySource().Read(old)!.Value, "Old", Ct);
var oldStore = new ScriptedStore(new StoreGame("epic", "old", "Old", Path.GetDirectoryName(old)!, old, null));
var review = new ScriptedReview(static c => [.. c.Where(static x => x.CanImport)]);
var strip = new RecordingStrip();
var nav = new FakeNavigator();
var changes = new LibraryChanges();
int announced = 0;
changes.Changed += (_, _) => announced++;
var flow = new ImportLibraryFlow(new LibraryImporter([oldStore], s.Games, new ExecutableIdentitySource(), new ExecutableLocator(), static _ => { }),
review, strip, nav, changes);
(await flow.RunAsync(onlyNew: true, Ct)).Should().BeNull();
review.Shown.Should().BeEmpty("nothing new, so no checklist");
strip.Kinds.Should().Equal("info");
announced.Should().Be(0);
string fresh = await ExeAsync("Fresh");
var both = new ScriptedStore(new StoreGame("epic", "old", "Old", Path.GetDirectoryName(old)!, old, null),
new StoreGame("epic", "fresh", "Fresh", Path.GetDirectoryName(fresh)!, fresh, null));
flow = new ImportLibraryFlow(new LibraryImporter([both], s.Games, new ExecutableIdentitySource(), new ExecutableLocator(), static _ => { }),
review, strip, nav, changes);
ImportReport? report = await flow.RunAsync(onlyNew: true, Ct);
report!.Added.Should().Be(1);
announced.Should().Be(1, "the Games page on screen reloads");
nav.Pages.Should().Equal(nameof(GamesPage));
}
[Fact]
public void TheReviewCountsTicksAndSelectAllSkipsWhatCannotBeImported()
{
@@ -150,4 +188,33 @@ public sealed class ImportLibraryFlowTests : IDisposable
vm.SelectedCount.Should().Be(1);
vm.Selected.Should().ContainSingle().Which.Should().Be(can);
}
/// <summary>
/// beta.11 (owner request 2026-10-03): the games already in the library — at this path or under another drive letter —
/// are hidden by default and come back, still unimportable, when the user asks; the count names how many.
/// </summary>
[Fact]
public void GamesAlreadyInTheLibraryAreHiddenUntilAskedFor()
{
var can = new ImportCandidate(new StoreGame("steam", "1", "A", @"C:\a", @"C:\a\a.exe", null), @"C:\a\a.exe", AlreadyInLibrary: false, ExecutableGuessed: false);
var already = new ImportCandidate(new StoreGame("steam", "2", "B", @"C:\b", @"C:\b\b.exe", null), @"C:\b\b.exe", AlreadyInLibrary: true, ExecutableGuessed: false);
var none = new ImportCandidate(new StoreGame("steam", "3", "C", @"C:\c", null, null), null, AlreadyInLibrary: false, ExecutableGuessed: true);
var moved = new ImportCandidate(new StoreGame("steam", "4", "D", @"D:\d", @"D:\d\d.exe", null), @"D:\d\d.exe", AlreadyInLibrary: false, ExecutableGuessed: false,
MovedFrom: @"H:\d\d.exe");
var vm = new ImportReviewViewModel([can, already, none, moved]);
vm.ExistingCount.Should().Be(2);
vm.HasExisting.Should().BeTrue();
vm.ShowExistingText.Should().Contain("2");
vm.Shown.Select(static r => r.Name).Should().Equal(["A", "C"], "a title with no executable is new and says why it cannot be imported");
vm.ShowExisting = true;
vm.Shown.Select(static r => r.Name).Should().Equal(["A", "B", "C", "D"]);
vm.Shown.Where(static r => r.IsExisting).Should().OnlyContain(static r => !r.CanImport, "shown dimmed, never importable");
vm.SelectAllCommand.Execute(null);
vm.SelectedCount.Should().Be(1, "showing them makes them no more importable");
vm.ShowExisting = false;
vm.Shown.Should().HaveCount(2);
}
}
@@ -253,6 +253,102 @@ public sealed class PagesLoadTests
element.UpdateLayout();
}
/// <summary>
/// beta.11 (owner request 2026-10-03: "the empty band on the right"): the library's cards share the whole width — every
/// card in a row as wide as the others, the row as wide as the panel — and the list view renders with the grid gone, the
/// choice remembered. Under the real dictionaries, so a style or binding typo is red here.
/// </summary>
[Fact]
public async Task TheLibraryGridFillsItsWidthAndTheListViewReplacesIt()
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
foreach (string name in new[] { "Alpha", "Bravo", "Charlie", "Delta", "Echo" })
{
_ = await s.GameAsync(name);
}
var selection = new GameSelection();
var nav = new NoNavigation();
var strip = new NoStrip();
var settings = new MemorySettings();
var games = new GamesViewModel(s.Library, selection, nav, new AddGameFlow(s.Library, new NoPicker(), selection, nav, strip),
settings: new RegisteredSettings(settings));
Task pending = games.Pending;
await pending;
games.HeaderText.Should().EndWith("5");
games.Games.Should().OnlyContain(static g => g.NotInstalled, "the scratch entries point at files that do not exist");
(double PanelWidth, double[] CardWidths, int Columns) grid = await OnStaAsync(() =>
{
var page = new GamesPage(games);
Render(page);
UniformWrapPanel panel = Find<UniformWrapPanel>(page)!;
double[] widths = [.. panel.Children.Cast<FrameworkElement>().Select(static c => c.ActualWidth)];
return (panel.ActualWidth, widths, UniformWrapPanel.ColumnsFor(panel.ActualWidth, panel.MinItemWidth, panel.Spacing));
});
grid.Columns.Should().BeGreaterThan(1);
grid.CardWidths.Should().OnlyContain(w => Math.Abs(w - grid.CardWidths[0]) < 0.5, "every card is an equal share");
((grid.Columns * grid.CardWidths[0]) + ((grid.Columns - 1) * 12)).Should().BeApproximately(grid.PanelWidth, 1, "a full row leaves no band unused");
games.ShowListCommand.Execute(null);
(bool ListShown, bool GridShown) list = await OnStaAsync(() =>
{
var page = new GamesPage(games);
Render(page);
return (((FrameworkElement)page.FindName("GameList")).Visibility == Visibility.Visible,
((FrameworkElement)page.FindName("CardGrid")).Visibility == Visibility.Visible);
});
list.ListShown.Should().BeTrue();
list.GridShown.Should().BeFalse();
settings.Rows.Should().ContainKey("ui.library_view").WhoseValue.Should().Be("list", "the choice is remembered");
}
/// <summary>beta.11: the import checklist renders with the rows already in the library shown, dimmed, under the real dictionaries.</summary>
[Fact]
public async Task TheImportChecklistRendersWithTheExistingRowsShown()
{
var vm = new ImportReviewViewModel(
[
new Application.Import.ImportCandidate(new Application.Import.StoreGame("steam", "1", "A", @"C:\a", @"C:\a\a.exe", null), @"C:\a\a.exe",
AlreadyInLibrary: false, ExecutableGuessed: false),
new Application.Import.ImportCandidate(new Application.Import.StoreGame("steam", "2", "B", @"C:\b", @"C:\b\b.exe", null), @"C:\b\b.exe",
AlreadyInLibrary: true, ExecutableGuessed: false),
])
{ ShowExisting = true };
int rows = await OnStaAsync(() =>
{
var content = new Dialogs.ImportReviewContent(vm);
Render(content);
return Find<System.Windows.Controls.DataGrid>(content)!.Items.Count;
});
rows.Should().Be(2);
}
/// <summary>The first descendant of <paramref name="root"/> of type <typeparamref name="T"/> in the visual tree, or null.</summary>
private static T? Find<T>(DependencyObject root)
where T : DependencyObject
{
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(root); i++)
{
DependencyObject child = System.Windows.Media.VisualTreeHelper.GetChild(root, i);
if (child is T hit)
{
return hit;
}
if (Find<T>(child) is { } deeper)
{
return deeper;
}
}
return null;
}
/// <summary>
/// beta.8 (owner request 2026-09-25): an anti-cheat game's page under the real dictionaries — the finding's card is
/// rendered, and the Hooking card, whose switch could only be refused, is not while <c>ui.hide_anticheat_hooking</c> is