public void Show(Dialog dialog, Action<bool> dialogClosedCallback) { eventAggregator.PublishMessage(new OpenModalDialogMessage(this)); var modalDialog = new ModalDialog(); modalDialog.DataContext = dialog; modalDialog.Show(); modalDialog.Closed += (o, e) => { var dialogResult = false; if (modalDialog.DialogResult.HasValue) dialogResult = (bool) modalDialog.DialogResult; dialogClosedCallback.Invoke(dialogResult); eventAggregator.PublishMessage(new CloseModalDialogMessage(this)); }; }
/// <summary> /// View must be disconnected before the dialog is closed. /// Else the View on the Dialog will closed by the Silverlight /// runtime. Then it can't be displayed anywhere else. /// </summary> private void DisconnectView() { DataContext = new Dialog(); }