We are working to migrate our INotification/IConfirmation dialogs to Prism's DialogService. One trouble we're having is supporting a customization we made to PopupWindowAction to optionally "bring to front" an existing non-modal dialog if the action was invoked a second time.
Can this be accomplished with DialogService?
Specifically, if a non-modal window is minimized or inactive (behind another window), how can we activate it? We are currently using code like the following which recognizes that a specific INotification was previously displayed and simply activates it.
if (BringToFrontIfExisting)
{
if (NotificationWindowMap.TryGetValue(notification, out Window window))
{
if (window.WindowState == WindowState.Minimized)
{
window.WindowState = WindowState.Normal;
}
window.Activate();
return;
}
}
We looked into extending DialogService; unfortunately it seems we'd need to extend ShowDialogInternal which is not virtual. Nor does IDialogWindow expose WindowState or Activate.
It seems we might be able to accomplish this externally by registering an instance of the dialog and managing this activation external to the DialogService. Though I'd like to work with Prism as much as possible here and minimize the complexity for the ViewModel.