Skip to content

Commit 77b4edf

Browse files
Force the "CloseConfirmDialog" to be visible
1 parent 18deb34 commit 77b4edf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

VBAudioRouter/App.xaml.vb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ NotInheritable Class App
2525
AddHandler SystemNavigationManagerPreview.GetForCurrentView().CloseRequested, Async Sub(sender As Object, ev As SystemNavigationCloseRequestedPreviewEventArgs)
2626
Dim deferral As Deferral = ev.GetDeferral()
2727
Try
28+
' Force all legacy dialogs to close
29+
For Each popup In VisualTreeHelper.GetOpenPopups(Window.Current)
30+
Dim legacyDialog As ContentDialog = TryCast(popup?.Child, ContentDialog)
31+
If legacyDialog IsNot Nothing Then
32+
legacyDialog.Hide()
33+
End If
34+
Next
35+
' Show confirmation dialog
2836
Dim dialog As New CloseConfirmDialog()
2937
dialog.RequestedTheme = ElementTheme.Dark
3038
ev.Handled = (Await dialog.ShowAsync()) = ContentDialogResult.Secondary

0 commit comments

Comments
 (0)