void OnWindowClosed(object sender, EventArgs e)
 {
     window.Closing -= OnWindowClosing;
     window.Closed  -= OnWindowClosed;
     DocumentViewModelHelper.OnDestroy(GetViewModel(window.RealWindow));
     window = null;
 }
 void window_Closed(object sender, EventArgs e)
 {
     RemoveFromWindowsList();
     Window.Closing -= window_Closing;
     Window.Closed  -= window_Closed;
     DocumentViewModelHelper.OnDestroy(GetContent());
 }
 public bool Close(bool force = false)
 {
     if (!force)
     {
         var eventArgs = new CancelEventArgs();
         OnPopup_Closing(eventArgs);
         if (eventArgs.Cancel)
         {
             return(false);
         }
     }
     if (AsyncAction != null)
     {
         AsyncAction.Cancel();
     }
     Window.Current.CoreWindow.SizeChanged -= CoreWindow_SizeChanged;
     if (Popup != null)
     {
         DocumentViewModelHelper.OnDestroy(ViewHelper.GetViewModelFromView(Content));
         Popup.IsOpen = false;
         Popup        = null;
     }
     return(true);
 }