Example #1
0
        public static void Show(NonfatalErrorEntry entry)
        {
            var text = (entry.Exception == null
                    ? $"{entry.DisplayName.TrimEnd('.')}." : $"{entry.DisplayName.TrimEnd('.')}:\n\n[b][mono]{entry.Exception.Message}[/mono][/b]") +
                       (entry.Commentary == null ? "" : $"\n\n[i]{entry.Commentary}[/i]");
            var dlg = new ModernDialog {
                Title   = UiStrings.Common_Oops,
                Content = new ScrollViewer {
                    Content = new SelectableBbCodeBlock {
                        BbCode = text, Margin = new Thickness(0, 0, 0, 8)
                    },
                    VerticalScrollBarVisibility   = ScrollBarVisibility.Auto,
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled
                },
                MinHeight = 0,
                MinWidth  = 0,
                MaxHeight = 480,
                MaxWidth  = 640
            };

            dlg.Buttons = entry.Solutions.Select(x => dlg.CreateFixItButton(x, entry)).Where(x => x != null).Union(new[] { dlg.OkButton });
            dlg.Show();

            entry.Unseen = false;
        }
Example #2
0
        public static void Show(NonfatalErrorEntry entry)
        {
            var text = (entry.Exception == null
                    ? $"{entry.DisplayName.TrimEnd('.')}."
                    : $"{entry.DisplayName.TrimEnd('.')}{ColonConverter.Colon}\n\n[b][mono]{entry.Exception.Message}[/mono][/b]") +
                       (entry.Commentary == null ? "" : $"\n\n[i]{entry.Commentary}[/i]");
            var dlg = new ModernDialog {
                Title   = CustomErrorTitle ?? UiStrings.Common_Oops,
                Content = new ScrollViewer {
                    Content = new SelectableBbCodeBlock {
                        Text = text, Margin = new Thickness(0, 0, 0, 8)
                    },
                    VerticalScrollBarVisibility   = ScrollBarVisibility.Auto,
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled
                },
                MinHeight = 0,
                MinWidth  = 0,
                MaxHeight = 480,
                MaxWidth  = 640,
                Owner     = null
            };

            var fixButtons = entry.Solutions.Select(x => dlg.CreateFixItButton(x, entry)).Where(x => x != null).ToList();

            if (fixButtons.Count > 0)
            {
                fixButtons[0].IsDefault = true;

                var closeButton = dlg.CloseButton;
                closeButton.IsDefault = false;
                dlg.Buttons           = fixButtons.Concat(new[] { dlg.CloseButton });
            }
            else
            {
                dlg.Buttons = new[] { dlg.OkButton };
            }
            dlg.Show();

            entry.Unseen = false;
        }