v0.16.0 — ThemedMessageBox replacing native MessageBox everywhere
The Win32 MessageBox uses the system white-on-gray look that clashes with the launcher's dark theme (jarring transition every time we confirm a cancel, show an error, etc.). Replaced with a custom WPF dialog that: - Drops in : same Show(message, title, button, icon, default) API as System.Windows.MessageBox, returns the same MessageBoxResult. - Looks native to the launcher : dark Brush.Bg.Window background, Brush.Border outline, Brush.Text.Primary content, AccentButton for the default action and SecondaryButton for the others. - Iconography by emoji + colour code : ⛔ red (Error), ⚠ amber (Warning), ❓ neutral (Question), ℹ blue (Information). Mapped from MessageBoxImage. - Buttons localised via Strings.ActionOk / ActionYes / ActionNo / ActionCancel — works in fr/en/zh/th/ar like the rest of the UI. - Owner = currently active window (falls back to MainWindow then CenterScreen) so it positions correctly even from a child dialog. - Esc resolves to Cancel/No matching MessageBox semantics. The 21 MessageBox.Show call sites across MainViewModel, SettingsViewModel, LicenseDetailsDialog and MainWindow now use ThemedMessageBox.Show with no signature change — full grep replace + tiny `using` adjustments. Versions bumped to 0.16.0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
72
src/PSLauncher.App/Views/ThemedMessageBox.xaml
Normal file
72
src/PSLauncher.App/Views/ThemedMessageBox.xaml
Normal file
@@ -0,0 +1,72 @@
|
||||
<Window x:Class="PSLauncher.App.Views.ThemedMessageBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:loc="clr-namespace:PSLauncher.Core.Localization;assembly=PSLauncher.Core"
|
||||
Title=""
|
||||
Icon="pack://application:,,,/Resources/favicon.ico"
|
||||
SizeToContent="Height"
|
||||
Width="480"
|
||||
MinHeight="180"
|
||||
MaxHeight="600"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Background="{StaticResource Brush.Bg.Window}">
|
||||
<Border BorderBrush="{StaticResource Brush.Border}" BorderThickness="1">
|
||||
<Grid Margin="24,20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title -->
|
||||
<TextBlock Grid.Row="0"
|
||||
x:Name="TitleText"
|
||||
FontSize="16" FontWeight="SemiBold"
|
||||
Foreground="{StaticResource Brush.Text.Primary}"
|
||||
Margin="0,0,0,12" />
|
||||
|
||||
<!-- Icon + Message -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0"
|
||||
x:Name="IconText"
|
||||
FontSize="36"
|
||||
Margin="0,2,16,0"
|
||||
VerticalAlignment="Top" />
|
||||
<TextBlock Grid.Column="1"
|
||||
x:Name="MessageText"
|
||||
TextWrapping="Wrap"
|
||||
FontSize="13" LineHeight="20"
|
||||
Foreground="{StaticResource Brush.Text.Primary}"
|
||||
VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="2"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,24,0,0">
|
||||
<Button x:Name="Btn1"
|
||||
Style="{StaticResource SecondaryButton}"
|
||||
MinWidth="80" Padding="16,8" Margin="0,0,8,0"
|
||||
Visibility="Collapsed"
|
||||
Click="OnBtn1Click" />
|
||||
<Button x:Name="Btn2"
|
||||
Style="{StaticResource SecondaryButton}"
|
||||
MinWidth="80" Padding="16,8" Margin="0,0,8,0"
|
||||
Visibility="Collapsed"
|
||||
Click="OnBtn2Click" />
|
||||
<Button x:Name="Btn3"
|
||||
Style="{StaticResource AccentButton}"
|
||||
MinWidth="80" Padding="16,8"
|
||||
Visibility="Collapsed"
|
||||
Click="OnBtn3Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
Reference in New Issue
Block a user