/// <summary> /// Shows a dialog and wait for it to close asynchronously /// </summary> /// <param name="sender">The object that is launching the dialog</param> /// <param name="dialog">The dialog to be shown</param> /// <returns>The DialogClosedEventArgs or null if no listener is found</returns> public static Task <DialogClosedEventArgs> ShowDialogForResult(object sender, BaseDialog dialog) { return(ShowDialogAsync(sender, dialog)?.ContinueWith(x => { return dialog.WaitForCloseAsync(); }).Unwrap()); }