public void Close(IDialogViewModel viewModel) { if (!viewModel.CanClose()) return; ViewModels.Remove(viewModel); viewModel.PropertyChanged -= ViewModelOnPropertyChanged; viewModel.IsShown = false; if (ViewModels.Count == 0) IsShown = false; }