private void CloseTabRequested(object sender, EventArgs e) { TabViewModel.CloseTabRequested -= CloseTabRequested; IWindowContext currentWindowContext = WindowManager.GetWindowContext(this); if (modalWindow) { currentWindowContext.CloseDialog(false); } else { currentWindowContext.Close(); } }