mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Show all inner exceptions for connectivity dialog
maybe using a viewmodel isnt a bad idea after all...
This commit is contained in:
parent
b1d0e11121
commit
173494641a
@ -16,17 +16,12 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
||||
{
|
||||
public ConnectivityDialog(string targetName, string description, Exception exception)
|
||||
{
|
||||
Exception? innerException = exception.InnerException;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
TitleTextBlock.Text = $"{App.ProjectName} is unable to connect to {targetName}";
|
||||
DescriptionTextBlock.Text = description;
|
||||
|
||||
ErrorRichTextBox.Selection.Text = $"{exception.GetType()}: {exception.Message}";
|
||||
|
||||
if (innerException is not null)
|
||||
ErrorRichTextBox.Selection.Text += $"\n\n===== Inner Exception =====\n{innerException.GetType()}: {innerException.Message}";
|
||||
AddException(exception);
|
||||
|
||||
CloseButton.Click += delegate
|
||||
{
|
||||
@ -41,5 +36,18 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
||||
PInvoke.FlashWindow((HWND)hWnd, true);
|
||||
};
|
||||
}
|
||||
|
||||
private void AddException(Exception exception, bool inner = false)
|
||||
{
|
||||
if (!inner)
|
||||
ErrorRichTextBox.Selection.Text = $"{exception.GetType()}: {exception.Message}";
|
||||
|
||||
if (exception.InnerException is null)
|
||||
return;
|
||||
|
||||
ErrorRichTextBox.Selection.Text += $"\n\n[Inner Exception]\n{exception.InnerException.GetType()}: {exception.InnerException.Message}";
|
||||
|
||||
AddException(exception.InnerException, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user