예제 #1
0
        public static void Show(string title, Exception exception, string errorMessage = null)
        {
            var errorViewModel = new ErrorViewModel();
            var errorView      = new ErrorView(errorViewModel);

            var owner = System.Windows.Application.Current.MainWindow;

            if (owner != null && errorView.Owner != owner)
            {
                errorView.Owner = owner;
            }

            var errorViewModelInfo = new ErrorViewModelInfo
            {
                Title        = title,
                ErrorMessage = errorMessage,
                Exception    = exception
            };

            errorViewModel.Configure(errorViewModelInfo);
            errorViewModel.Closed += (s, a) => errorView?.Close();
            errorView.ShowDialog();
        }