Exemplo n.º 1
0
 /// <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(() => { }));
 }
Exemplo n.º 2
0
 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();
     }
 }
Exemplo n.º 3
0
 public virtual void OnClose()
 {
     // this is only set when a dialog is shown (externally) in it's OWN window.
     if (ParentDialogWindow != null)
     {
         ParentDialogWindow.Close();
     }
 }