v1.08 — Custom Fluent confirmation dialog, replace all MessageBox
- New ConfirmDialog overlay with dark backdrop, rounded card, shadow - Warning/Question/Error icon types with accent colors - Replaced all MessageBox.Show calls (RemovePage, PreInstallCheck, Troubleshoot) - Click outside dialog = cancel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
<Company>InstaSoft Zrt.</Company>
|
||||
<Product>InstaSoft Office Tool</Product>
|
||||
<Copyright>Copyright (c) InstaSoft Zrt. 2026</Copyright>
|
||||
<Version>1.0.7</Version>
|
||||
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||
<FileVersion>1.0.7.0</FileVersion>
|
||||
<Version>1.0.8</Version>
|
||||
<AssemblyVersion>1.0.8.0</AssemblyVersion>
|
||||
<FileVersion>1.0.8.0</FileVersion>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<Window x:Class="InstaSoftOfficeTool.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:pages="clr-namespace:InstaSoftOfficeTool.Pages"
|
||||
Title="InstaSoft Office Tool"
|
||||
Width="800" Height="550"
|
||||
ResizeMode="NoResize"
|
||||
@@ -9,6 +10,8 @@
|
||||
TextElement.Foreground="{StaticResource TextPrimaryBrush}">
|
||||
|
||||
<Grid>
|
||||
<!-- Main content -->
|
||||
<Grid x:Name="MainGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="64"/>
|
||||
<RowDefinition Height="*"/>
|
||||
@@ -42,7 +45,7 @@
|
||||
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,-2,0,0"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<TextBlock Text="v1.07" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
<TextBlock Text="v1.08" HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
FontSize="12" Foreground="{StaticResource TextSecondaryBrush}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
@@ -71,4 +74,8 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- Confirm dialog overlay -->
|
||||
<pages:ConfirmDialog x:Name="Dialog" Grid.RowSpan="3"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
@@ -194,6 +195,13 @@ namespace InstaSoftOfficeTool
|
||||
BtnNext.Click += (s, e) => Close();
|
||||
}
|
||||
|
||||
public Task<bool> ConfirmAsync(string title, string message,
|
||||
string confirmText = "Igen", string cancelText = "M\u00e9gse",
|
||||
DialogType type = DialogType.Warning)
|
||||
{
|
||||
return Dialog.ShowAsync(title, message, confirmText, cancelText, type);
|
||||
}
|
||||
|
||||
public void ShowBackToHomeButton()
|
||||
{
|
||||
BtnBack.Content = "\u2190 F\u0151oldal";
|
||||
|
||||
41
Pages/ConfirmDialog.xaml
Normal file
41
Pages/ConfirmDialog.xaml
Normal file
@@ -0,0 +1,41 @@
|
||||
<UserControl x:Class="InstaSoftOfficeTool.Pages.ConfirmDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Visibility="Collapsed">
|
||||
|
||||
<!-- Backdrop overlay -->
|
||||
<Grid>
|
||||
<Border Background="#66000000" MouseDown="Backdrop_MouseDown"/>
|
||||
|
||||
<!-- Dialog card -->
|
||||
<Border Background="{StaticResource CardBrush}" CornerRadius="12"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
MinWidth="400" MaxWidth="500" Padding="28,24">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect ShadowDepth="8" BlurRadius="32" Opacity="0.2" Color="Black"/>
|
||||
</Border.Effect>
|
||||
|
||||
<StackPanel>
|
||||
<!-- Icon + Title -->
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,12">
|
||||
<TextBlock x:Name="DialogIcon" FontFamily="Segoe MDL2 Assets" FontSize="22"
|
||||
VerticalAlignment="Center" Margin="0,0,12,0"/>
|
||||
<TextBlock x:Name="DialogTitle" FontSize="18" FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Message -->
|
||||
<TextBlock x:Name="DialogMessage" FontSize="14" TextWrapping="Wrap"
|
||||
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,0,0,24"/>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button x:Name="BtnCancel" Style="{StaticResource SecondaryButton}"
|
||||
Click="BtnCancel_Click" Margin="0,0,8,0"/>
|
||||
<Button x:Name="BtnConfirm" Style="{StaticResource PrimaryButton}"
|
||||
Click="BtnConfirm_Click"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
75
Pages/ConfirmDialog.xaml.cs
Normal file
75
Pages/ConfirmDialog.xaml.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace InstaSoftOfficeTool.Pages
|
||||
{
|
||||
public partial class ConfirmDialog : UserControl
|
||||
{
|
||||
private TaskCompletionSource<bool> _tcs;
|
||||
|
||||
public ConfirmDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public Task<bool> ShowAsync(string title, string message,
|
||||
string confirmText = "Igen", string cancelText = "M\u00e9gse",
|
||||
DialogType type = DialogType.Warning)
|
||||
{
|
||||
DialogTitle.Text = title;
|
||||
DialogMessage.Text = message;
|
||||
BtnConfirm.Content = confirmText;
|
||||
BtnCancel.Content = cancelText;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case DialogType.Warning:
|
||||
DialogIcon.Text = "\uE7BA";
|
||||
DialogIcon.Foreground = (Brush)FindResource("WarningBrush");
|
||||
break;
|
||||
case DialogType.Question:
|
||||
DialogIcon.Text = "\uE9CE";
|
||||
DialogIcon.Foreground = (Brush)FindResource("AccentBrush");
|
||||
break;
|
||||
case DialogType.Error:
|
||||
DialogIcon.Text = "\uE711";
|
||||
DialogIcon.Foreground = (Brush)FindResource("ErrorBrush");
|
||||
break;
|
||||
}
|
||||
|
||||
Visibility = Visibility.Visible;
|
||||
_tcs = new TaskCompletionSource<bool>();
|
||||
return _tcs.Task;
|
||||
}
|
||||
|
||||
private void BtnConfirm_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Visibility = Visibility.Collapsed;
|
||||
_tcs?.TrySetResult(true);
|
||||
}
|
||||
|
||||
private void BtnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Visibility = Visibility.Collapsed;
|
||||
_tcs?.TrySetResult(false);
|
||||
}
|
||||
|
||||
private void Backdrop_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
// click outside = cancel
|
||||
Visibility = Visibility.Collapsed;
|
||||
_tcs?.TrySetResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
public enum DialogType
|
||||
{
|
||||
Warning,
|
||||
Question,
|
||||
Error
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,13 @@ namespace InstaSoftOfficeTool.Pages
|
||||
|
||||
private async void BtnRemove_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
bool confirmed = await _main.ConfirmAsync(
|
||||
"Office elt\u00e1vol\u00edt\u00e1s",
|
||||
"Biztosan el szeretn\u00e9 t\u00e1vol\u00edtani a kiv\u00e1lasztott Office telep\u00edt\u00e9seket az \u00faj verzi\u00f3 telep\u00edt\u00e9se el\u0151tt?",
|
||||
"Elt\u00e1vol\u00edt\u00e1s", "M\u00e9gse");
|
||||
|
||||
if (!confirmed) return;
|
||||
|
||||
BtnRemove.IsEnabled = false;
|
||||
BtnSkip.IsEnabled = false;
|
||||
LogPanel.Visibility = Visibility.Visible;
|
||||
|
||||
@@ -51,11 +51,12 @@ namespace InstaSoftOfficeTool.Pages
|
||||
|
||||
private async void BtnRemove_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var result = MessageBox.Show(
|
||||
bool confirmed = await _main.ConfirmAsync(
|
||||
"Office elt\u00e1vol\u00edt\u00e1s",
|
||||
"Biztosan el szeretn\u00e9 t\u00e1vol\u00edtani a kiv\u00e1lasztott Office telep\u00edt\u00e9seket?",
|
||||
"Meger\u0151s\u00edt\u00e9s", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||
"Elt\u00e1vol\u00edt\u00e1s", "M\u00e9gse");
|
||||
|
||||
if (result != MessageBoxResult.Yes) return;
|
||||
if (!confirmed) return;
|
||||
|
||||
BtnRemove.IsEnabled = false;
|
||||
LogPanel.Visibility = Visibility.Visible;
|
||||
|
||||
@@ -194,11 +194,12 @@ namespace InstaSoftOfficeTool.Pages
|
||||
var btn = (Button)sender;
|
||||
var last5 = (string)btn.Tag;
|
||||
|
||||
var result = MessageBox.Show(
|
||||
bool confirmed = await _main.ConfirmAsync(
|
||||
"Kulcs elt\u00e1vol\u00edt\u00e1sa",
|
||||
"Biztosan el szeretn\u00e9 t\u00e1vol\u00edtani a *****-" + last5 + " kulcsot?",
|
||||
"Meger\u0151s\u00edt\u00e9s", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
"Elt\u00e1vol\u00edt\u00e1s", "M\u00e9gse", DialogType.Question);
|
||||
|
||||
if (result != MessageBoxResult.Yes) return;
|
||||
if (!confirmed) return;
|
||||
|
||||
btn.IsEnabled = false;
|
||||
btn.Content = "...";
|
||||
@@ -223,12 +224,13 @@ namespace InstaSoftOfficeTool.Pages
|
||||
|
||||
private async void BtnRemoveAll_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var result = MessageBox.Show(
|
||||
bool confirmed = await _main.ConfirmAsync(
|
||||
"\u00d6sszes kulcs elt\u00e1vol\u00edt\u00e1sa",
|
||||
"Biztosan el szeretn\u00e9 t\u00e1vol\u00edtani az \u00f6sszes telep\u00edtett term\u00e9kkulcsot (" + _entries.Count + " db)?\n\n" +
|
||||
"Ez nem t\u00f6r\u00f6l adatot, csak az aktiv\u00e1ci\u00f3s \u00e1llapotot \u00e1ll\u00edtja vissza.",
|
||||
"Meger\u0151s\u00edt\u00e9s", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||
"\u00d6sszes elt\u00e1vol\u00edt\u00e1sa", "M\u00e9gse");
|
||||
|
||||
if (result != MessageBoxResult.Yes) return;
|
||||
if (!confirmed) return;
|
||||
|
||||
BtnRemoveAll.IsEnabled = false;
|
||||
BtnRefresh.IsEnabled = false;
|
||||
|
||||
Reference in New Issue
Block a user