コード例 #1
0
        /// <summary>
        /// Open a dialog window.
        /// </summary>
        /// <typeparam name="T">Dialog result type.</typeparam>
        /// <param name="viewModel">Dialog view model.</param>
        /// <returns>returns <typeparamref name="T"/> result.</returns>
        public T OpenDialog <T>(DialogViewModelBase <T> viewModel)
        {
            var window = (IDialogWindow)Activator.CreateInstance(_window.GetType());

            window.DataContext = viewModel ?? throw new ArgumentNullException(nameof(viewModel));
            window.ShowDialog();
            return(viewModel.DialogResult);
        }