So I´m using: public sealed partial class SynchronizationDialog : ContentDialog.
I have an UWP app. When I press on a button in the UWP app the SynchronizationDialog opens and the app starts to download documents. The progress can be seen in the Dialog.
After the downloads are done the dialog "closes" by using this.Hide();
Now my problem is that when I press the Escape-key the Dialog disappears. Yet the download is still going and everything works just fine.
How can I prevent the Dialog from disappearing? I tried this:
public SynchronizationDialog()
{
this.InitializeComponent();
this.Loaded += SynchronizationDialog_Loaded;
this.Closing += ContentDialog_Closing; //this is what I tried
}
//....
void ContentDialog_Closing(ContentDialog sender, ContentDialogClosingEventArgs args)
{
bool doNotClose = true;
if (doNotClose)
{
args.Cancel = true;
}
}
The Dialog doesnt disappear this way. But after the download is finished and this.Hide(); happens the Dialog does not hide. I also cannot cancel the dialog so it stays there till I restart the app.