I am working on a WPF desktop application, which has screen-lock feature that shows the log-in dialog after application is inactive for some time. Everything works great until user walks away from the computer and there's modal dialog (other than the log-in dialog) opened in the app.
Quick summary of the scenario:
- User deletes something in the application.
- Delete confirmation (modal) dialog opens, with "Delete" and "Cancel" options.
- User walks away for a bit, while the modal dialog is up.
- After some time, the confirmation dialog will be hidden and the log-in dialog opens.
Here's a bit of the codes
var deleteConfirmationDialog = new deleteConfirmationDialog(deleteConfirmationViewModel);
var dialogResult = deleteConfirmationDialog.ShowDialog();
if (dialogResult ?? false) { //Delete item }
The issue is when the deleteConfirmationDialog is hidden, and the log-in (modal) dialog is opened, then the dialogResult from the deleteConfirmationDialog will return with dialogresult == false.
Technical implementation and philosophy aside, why does ShowDialog() returns with a DialogResult == false, even though I did not close that dialog? Is there away to prevent deleteConfirmationDialog from returning False?
Thank you very much in advance! Please let me know, if any part of this doesn't make sense.