/// <summary> /// Requests an externally shown Dialog to close. Will throw an exception if the Dialog is inside of a MetroWindow. /// </summary> public Task RequestCloseAsync() { if (OnRequestClose()) { //Technically, the Dialog is /always/ inside of a MetroWindow. //If the dialog is inside of a user-created MetroWindow, not one created by the external dialog APIs. if (ParentDialogWindow == null) { //This is from a user-created MetroWindow return(DialogManager.HideMetroDialogAsync(OwningWindow, this)); } else { //This is from a MetroWindow created by the external dialog APIs. return(_WaitForCloseAsync().ContinueWith(x => { ParentDialogWindow.Dispatcher.Invoke(new Action(() => { ParentDialogWindow.Close(); })); })); } } return(Task.Factory.StartNew(() => { })); }
internal protected virtual void OnClose() { if (ParentDialogWindow != null) //this is only set when a dialog is shown (externally) in it's OWN window. { ParentDialogWindow.Close(); } }
public virtual void OnClose() { // this is only set when a dialog is shown (externally) in it's OWN window. if (ParentDialogWindow != null) { ParentDialogWindow.Close(); } }