Code review cleanup: dead code, unused capability, accessibility gap

- Remove unused `using Microsoft.Win32;` from MainPage.xaml.cs (leftover
  from the WPF OpenFileDialog era; WinUI uses Windows.Storage.Pickers)
- Trim App.xaml.cs down to the two usings it actually needs instead of the
  full WinUI3 template boilerplate list
- Change App.MainWindowInstance to an internal setter (only MainWindow
  itself should assign it)
- Add AutomationProperties.Name to the icon-only Settings button so screen
  readers announce it (it only had a mouse tooltip before)
- Delete Assets/AppIcon.ico: unreferenced by both the manifest and code,
  the real app icon comes from ApplicationIcon (branding/AmiReel.ico) and
  AppWindow.SetIcon at runtime
- Drop the systemAIModels capability from Package.appxmanifest; the app
  doesn't call any Windows AI API, so declaring it is an unnecessary
  privilege request

Verified: dotnet build produces 0 warnings/errors, app launches unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-13 14:13:22 +02:00
parent 603af17e56
commit 3de3357d23
6 changed files with 6 additions and 23 deletions
-1
View File
@@ -27,7 +27,6 @@
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" /> <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\Square44x44Logo.targetsize-48_altform-lightunplated.png" /> <Content Include="Assets\Square44x44Logo.targetsize-48_altform-lightunplated.png" />
<Content Include="Assets\StoreLogo.png" /> <Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\AppIcon.ico" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" /> <Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup> </ItemGroup>
+3 -17
View File
@@ -1,20 +1,6 @@
using Windows.ApplicationModel; using Microsoft.UI.Xaml;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.UI.Xaml.Shapes;
using WinRT.Interop; using WinRT.Interop;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace AmiReel; namespace AmiReel;
/// <summary> /// <summary>
@@ -24,8 +10,8 @@ public partial class App : Application
{ {
private Window? _window; private Window? _window;
public static IntPtr MainWindowHandle { get; private set; } public static IntPtr MainWindowHandle { get; private set; }
public static MainWindow? MainWindowInstance { get; set; } public static MainWindow? MainWindowInstance { get; internal set; }
/// <summary> /// <summary>
/// Initializes the singleton application object. This is the first line of authored code /// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain(). /// executed, and as such is the logical equivalent of main() or WinMain().
Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

+2 -1
View File
@@ -113,7 +113,8 @@
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="10"> <StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="10">
<Button x:Name="OpenSettingsButton" Content="&#xE713;" FontFamily="Segoe Fluent Icons, Segoe MDL2 Assets" <Button x:Name="OpenSettingsButton" Content="&#xE713;" FontFamily="Segoe Fluent Icons, Segoe MDL2 Assets"
Click="OpenSettings_Click" Style="{StaticResource IconButtonStyle}" ToolTipService.ToolTip="Settings" /> Click="OpenSettings_Click" Style="{StaticResource IconButtonStyle}"
ToolTipService.ToolTip="Settings" AutomationProperties.Name="Settings" />
<Button x:Name="CancelButton" Content="Cancel" Click="Cancel_Click" IsEnabled="False" /> <Button x:Name="CancelButton" Content="Cancel" Click="Cancel_Click" IsEnabled="False" />
<Button x:Name="RenderButton" Content="Start render" Click="Render_Click" Style="{StaticResource PrimaryButtonStyle}" /> <Button x:Name="RenderButton" Content="Start render" Click="Render_Click" Style="{StaticResource PrimaryButtonStyle}" />
</StackPanel> </StackPanel>
-1
View File
@@ -6,7 +6,6 @@ using AmiReel.Models;
using AmiReel.Services; using AmiReel.Services;
using Microsoft.UI.Xaml; using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls;
using Microsoft.Win32;
using Windows.ApplicationModel.DataTransfer; using Windows.ApplicationModel.DataTransfer;
using Windows.Storage; using Windows.Storage;
using Windows.Storage.Pickers; using Windows.Storage.Pickers;
+1 -3
View File
@@ -5,8 +5,7 @@
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:systemai="http://schemas.microsoft.com/appx/manifest/systemai/windows10" IgnorableNamespaces="uap rescap">
IgnorableNamespaces="uap rescap systemai">
<Identity <Identity
Name="F004AE73-5989-46F3-B913-E9A3A355713F" Name="F004AE73-5989-46F3-B913-E9A3A355713F"
@@ -48,6 +47,5 @@
<Capabilities> <Capabilities>
<rescap:Capability Name="runFullTrust" /> <rescap:Capability Name="runFullTrust" />
<systemai:Capability Name="systemAIModels"/>
</Capabilities> </Capabilities>
</Package> </Package>