v0.5 fixes: settings crash, ContextMenu icon column, auto-refresh
Settings crash on ⚙ click ------------------------- The InverseBoolConverter was declared with `xmlns:local` inline on the resource element. WPF's BAML compiler did parse it, but the resource lookup at dialog open time was unstable depending on which XAML reader processed it first. Move the namespace declaration to the ResourceDictionary root (xmlns:res) — standard pattern, no more crash. White strip on the left of the ContextMenu ------------------------------------------ WPF's default MenuItem template renders a column for the icon/check indicator that's painted in SystemColors.MenuBarBrush (light gray on default themes), creating a visible white strip on a dark menu. Fix by fully retemplating MenuItem with just a Border + ContentPresenter for the header, no icon column, no check indicator. Hover state uses #2C2C32 to match the rest of the dark theme. Separator is also styled to use Brush.Border. Auto-refresh on startup ----------------------- MainViewModel now triggers CheckForUpdatesAsync from its constructor via a fire-and-forget Task. A 500ms delay lets the UI render before the HTTP call, and the call is dispatched back to the UI thread for the VM state mutations. Failures (offline, server down) are logged but don't prevent the launcher from being usable on installed versions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:PSLauncher.App.Resources">
|
||||
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
|
||||
<!-- Inverse bool : utilisé pour griser un bouton pendant qu'une opération est en cours -->
|
||||
<local:InverseBoolConverter x:Key="InverseBoolToBool" xmlns:local="clr-namespace:PSLauncher.App.Resources" />
|
||||
<res:InverseBoolConverter x:Key="InverseBoolToBool" />
|
||||
|
||||
<!-- Epic Games inspired dark palette -->
|
||||
<SolidColorBrush x:Key="Brush.Bg.Window" Color="#1B1B1F" />
|
||||
@@ -165,13 +166,39 @@
|
||||
<Setter Property="Padding" Value="4" />
|
||||
</Style>
|
||||
|
||||
<!-- MenuItem dark : on retemplatise pour virer la "icon column" claire à gauche
|
||||
que WPF dessine par défaut. -->
|
||||
<Style TargetType="MenuItem">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{StaticResource Brush.Text.Primary}" />
|
||||
<Setter Property="Padding" Value="10,6" />
|
||||
<Setter Property="Padding" Value="12,8" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="MenuItem">
|
||||
<Border x:Name="Bd"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="3"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter ContentSource="Header"
|
||||
VerticalAlignment="Center"
|
||||
RecognizesAccessKey="True" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsHighlighted" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="#2C2C32" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{StaticResource Brush.Text.Secondary}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Separator">
|
||||
<Setter Property="Height" Value="1" />
|
||||
<Setter Property="Background" Value="{StaticResource Brush.Border}" />
|
||||
<Setter Property="Margin" Value="4,4" />
|
||||
</Style>
|
||||
|
||||
@@ -127,6 +127,20 @@ public sealed partial class MainViewModel : ObservableObject
|
||||
_license = _licenseService.GetCached();
|
||||
|
||||
RebuildList();
|
||||
|
||||
// Vérification automatique des MAJ au démarrage (silencieuse et non bloquante)
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await Task.Delay(500); // laisse l'UI se stabiliser
|
||||
await Application.Current.Dispatcher.InvokeAsync(async () =>
|
||||
{
|
||||
await CheckForUpdatesAsync();
|
||||
});
|
||||
}
|
||||
catch (Exception ex) { _logger.LogWarning(ex, "Auto check at startup failed"); }
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user