diff --git a/scripts/Show-Notification.ps1 b/scripts/Show-Notification.ps1 index f86dced..33affad 100644 --- a/scripts/Show-Notification.ps1 +++ b/scripts/Show-Notification.ps1 @@ -143,20 +143,25 @@ if ($Type -eq 'BufferStarted') { $txtBody.Inlines.Add("`n`nIT can retrieve this file if needed for a support case.") } -# Countdown timer — auto-dismisses after 30 seconds -# Use a hashtable for shared state so the closure captures it by reference correctly -$state = @{ Tick = 30 } -$btnOK.Content = 'OK (30)' -$timer = New-Object System.Windows.Threading.DispatcherTimer -$timer.Interval = [TimeSpan]::FromSeconds(1) -$timer.Add_Tick({ - $state.Tick-- - $btnOK.Content = "OK ($($state.Tick))" - if ($state.Tick -le 0) { - $timer.Stop() - $window.Close() - } -}.GetNewClosure()) -$timer.Start() -$btnOK.Add_Click({ $timer.Stop(); $window.Close() }.GetNewClosure()) +if ($Type -eq 'ReplaySaved') { + # Countdown timer — auto-dismisses after 30 seconds + # Use a hashtable for shared state so the closure captures it by reference correctly + $state = @{ Tick = 30 } + $btnOK.Content = 'OK (30)' + $timer = New-Object System.Windows.Threading.DispatcherTimer + $timer.Interval = [TimeSpan]::FromSeconds(1) + $timer.Add_Tick({ + $state.Tick-- + $btnOK.Content = "OK ($($state.Tick))" + if ($state.Tick -le 0) { + $timer.Stop() + $window.Close() + } + }.GetNewClosure()) + $timer.Start() + $btnOK.Add_Click({ $timer.Stop(); $window.Close() }.GetNewClosure()) +} else { + $btnOK.Content = 'OK' + $btnOK.Add_Click({ $window.Close() }.GetNewClosure()) +} $window.ShowDialog() | Out-Null