private void ShowWindow(IViewModel viewModel, bool asDialog)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            if (_openedWindowsMap.ContainsKey(viewModel))
            {
                throw new InvalidOperationException("Окно для этой ViewModel уже открыто");
            }

            IDisplayWindow window = CreateWindowInstance(viewModel);

            _openedWindowsMap[viewModel] = window;

            if (asDialog)
            {
                window.ShowDialog();
                _openedWindowsMap.Remove(viewModel);
            }
            else
            {
                window.Show();
            }
        }
        public TResult ShowDialog<TArg, TResult>(IDialogViewModel<TArg, TResult> viewModel, TArg dialogArg = default(TArg))
        {
            if (viewModel == null)
                throw new ArgumentNullException(nameof(viewModel));

            IDisplayWindow window = CreateWindowInstance(viewModel);
            _openedWindowsMap[viewModel] = window;

            // Передаём аргумент во viewModel.
            viewModel.DialogArg = dialogArg;

            // Выводим диалоговое окно.
            window.ShowDialog();
            if (_openedWindowsMap.ContainsKey(viewModel))
                _openedWindowsMap.Remove(viewModel);

            // Возвращаем результат.
            return viewModel.DialogResult;
        }