From 3d6259f1179f59458172a402e3a9fdd50789a254 Mon Sep 17 00:00:00 2001 From: Raphire <9938813+Raphire@users.noreply.github.com> Date: Sun, 8 Mar 2026 22:31:09 +0100 Subject: [PATCH] When script encounters an error, show button for reporting the issue --- Scripts/GUI/Show-ApplyModal.ps1 | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Scripts/GUI/Show-ApplyModal.ps1 b/Scripts/GUI/Show-ApplyModal.ps1 index de0b0cc..0cc42d9 100644 --- a/Scripts/GUI/Show-ApplyModal.ps1 +++ b/Scripts/GUI/Show-ApplyModal.ps1 @@ -87,6 +87,7 @@ function Show-ApplyModal { $script:ApplyStepNameEl.Text = "Preparing..." $script:ApplyStepCounterEl.Text = "Preparing..." $script:ApplyProgressBarEl.Value = 0 + $script:ApplyModalInErrorState = $false # Set up progress callback for ExecuteAllChanges $script:ApplyProgressCallback = { @@ -192,6 +193,23 @@ function Show-ApplyModal { $script:ApplyCompletionIconEl.Foreground = [System.Windows.Media.SolidColorBrush]::new([System.Windows.Media.ColorConverter]::ConvertFromString("#c42b1c")) $script:ApplyCompletionTitleEl.Text = "Error" $script:ApplyCompletionMessageEl.Text = "An error occurred while applying changes: $($_.Exception.Message)" + + # Set error state to change Kofi button to report link + $script:ApplyModalInErrorState = $true + + # Update Kofi button to be a report issue button + $applyKofiBtn.Content = $null + + $reportText = [System.Windows.Controls.TextBlock]::new() + $reportText.Text = 'Report the issue' + $reportText.VerticalAlignment = 'Center' + $reportText.FontSize = 14 + $reportText.Margin = [System.Windows.Thickness]::new(0, 0, 0, 1) + + $applyKofiBtn.Content = $reportText + + [System.Windows.Automation.AutomationProperties]::SetName($applyKofiBtn, 'Report the issue') + $applyWindow.Dispatcher.Invoke([System.Windows.Threading.DispatcherPriority]::Render, [action]{}) } finally { @@ -206,7 +224,11 @@ function Show-ApplyModal { }) $applyKofiBtn.Add_Click({ - Start-Process "https://ko-fi.com/raphire" + if ($script:ApplyModalInErrorState) { + Start-Process "https://github.com/Raphire/Win11Debloat/issues/new" + } else { + Start-Process "https://ko-fi.com/raphire" + } }) $applyCancelBtn.Add_Click({