Пример #1
0
        void ExitMessageHandler(Exception e, Tuple<string, bool> r, string moreInfo = null) {
            const string title = "A known fatal error has occurred";

            var message = new XmlSanitizer().SanitizeXmlString(r.Item1);

            TryShowDialog(moreInfo, message, title, e);

            if (!r.Item2)
                return;

            Thread.Sleep(3000);
            Environment.Exit(1);
        }
Пример #2
0
        static bool ShowExceptionDialog(string message, string title, Exception e, object window = null) {
            message = new XmlSanitizer().SanitizeXmlString(message);

            var ev = new ExceptionDialogViewModel(e.Format()) {
                Message = message,
                Title = title,
                Exception = e
            };

            var w = new ExceptionDialogView {DataContext = ev};
            if (window == null)
                DialogHelper.SetMainWindowOwner(w);
            else
                w.Owner = (Window) window;
            w.ShowDialog();

            if (ev.Throw)
                throw new ExceptionDialogThrownException("Redirected exception", e);

            return ev.Cancel;
        }