コード例 #1
0
        public static void Show(Window owner, string title, string message, Exception e, params Exception[] additionalExceptions)
        {
            string split = Environment.NewLine + "--------------------" + Environment.NewLine;

            var dlg = new ExceptionDialog
            {
                ErrorMessage =
                {
                    Text = message
                },
                ErrorTrace =
                {
                    Text = string.Join(split, new List <Exception> {
                        e
                    }.Concat(additionalExceptions).Select(ex => FormatException(ex, "")))
                },
                Title = title,
            };

            if (owner != null && owner.IsLoaded)
            {
                dlg.Owner = owner;
            }
            else
            {
                dlg.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            }

            dlg.ShowDialog();
        }
コード例 #2
0
        public static void Show(Window owner, string title, Exception e, string additionalInfo)
        {
            var dlg = new ExceptionDialog();

            dlg.Title             = "Error in AlephNote v" + App.APP_VERSION;
            dlg.ErrorMessage.Text = title;
            dlg.ErrorTrace.Text   = (FormatException(e, additionalInfo) ?? FormatStacktrace(additionalInfo));

            if (owner != null && owner.IsLoaded)
            {
                dlg.Owner = owner;
            }
            else
            {
                dlg.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            }

            dlg.ShowDialog();
        }