Revise exception help message

This commit is contained in:
pizzaboxer 2024-07-05 10:34:23 +04:00
parent 6eebb54435
commit b3366583c9
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
4 changed files with 12 additions and 64 deletions

View File

@ -712,7 +712,9 @@ namespace Bloxstrap.Resources {
}
/// <summary>
/// Looks up a localized string similar to Please report this exception through a GitHub issue or in our Discord chat, along with a copy of the log file that was created..
/// Looks up a localized string similar to Check the [Bloxstrap Wiki]({0}) first to see if this problem has already been addressed with a fix.
///
///If not, then please report this exception through a [GitHub issue]({1}) along with a copy of the log file that was created..
/// </summary>
public static string Dialog_Exception_Info_2 {
get {
@ -720,33 +722,6 @@ namespace Bloxstrap.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Submit report....
/// </summary>
public static string Dialog_Exception_SubmitReport {
get {
return ResourceManager.GetString("Dialog.Exception.SubmitReport", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Submit report via Discord.
/// </summary>
public static string Dialog_Exception_SubmitReportDiscord {
get {
return ResourceManager.GetString("Dialog.Exception.SubmitReportDiscord", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Submit report via GitHub.
/// </summary>
public static string Dialog_Exception_SubmitReportGithub {
get {
return ResourceManager.GetString("Dialog.Exception.SubmitReportGithub", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Bloxstrap Exception.
/// </summary>

View File

@ -319,16 +319,9 @@ Click for more information</value>
<value>An exception occurred while running Bloxstrap</value>
</data>
<data name="Dialog.Exception.Info.2" xml:space="preserve">
<value>Please report this exception through a GitHub issue or in our Discord chat, along with a copy of the log file that was created.</value>
</data>
<data name="Dialog.Exception.SubmitReport" xml:space="preserve">
<value>Submit report...</value>
</data>
<data name="Dialog.Exception.SubmitReportDiscord" xml:space="preserve">
<value>Submit report via Discord</value>
</data>
<data name="Dialog.Exception.SubmitReportGithub" xml:space="preserve">
<value>Submit report via GitHub</value>
<value>Check the [Bloxstrap Wiki]({0}) first to see if this problem has already been addressed with a fix.
If not, then please report this exception through a [GitHub issue]({1}) along with a copy of the log file that was created.</value>
</data>
<data name="Dialog.Exception.Title" xml:space="preserve">
<value>Bloxstrap Exception</value>

View File

@ -1,9 +1,12 @@
<ui:UiWindow x:Class="Bloxstrap.UI.Elements.Dialogs.ExceptionDialog"
<base:WpfUiWindow x:Class="Bloxstrap.UI.Elements.Dialogs.ExceptionDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
xmlns:controls="clr-namespace:Bloxstrap.UI.Elements.Controls"
xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Dialogs"
xmlns:resources="clr-namespace:Bloxstrap.Resources"
mc:Ignorable="d"
@ -32,20 +35,15 @@
<StackPanel Grid.Column="1">
<TextBlock Text="{x:Static resources:Strings.Dialog_Exception_Info_1}" FontSize="18" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<RichTextBox x:Name="ErrorRichTextBox" Padding="8" Margin="0,16,0,0" Block.LineHeight="2" FontFamily="Courier New" IsReadOnly="True" />
<TextBlock Text="{x:Static resources:Strings.Dialog_Exception_Info_2}" Margin="0,16,0,0" TextWrapping="Wrap" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
<controls:MarkdownTextBlock MarkdownText="{Binding Source={x:Static resources:Strings.Dialog_Exception_Info_2}, Converter={StaticResource StringFormatConverter}, ConverterParameter='https://github.com/pizzaboxer/bloxstrap/wiki|https://github.com/pizzaboxer/bloxstrap/issues/new?template=bug_report.yaml'}" Margin="0,16,0,0" TextWrapping="Wrap" Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
</StackPanel>
</Grid>
<Border Grid.Row="2" Padding="15" Background="{ui:ThemeResource SolidBackgroundFillColorSecondaryBrush}">
<StackPanel Orientation="Horizontal" FlowDirection="LeftToRight" HorizontalAlignment="Right">
<Button x:Name="LocateLogFileButton" Content="{x:Static resources:Strings.Common_LocateLogFile}" />
<ComboBox x:Name="ReportOptions" SelectedIndex="0" Padding="12,6,12,6" Margin="12,0,0,0">
<ComboBoxItem Content="{x:Static resources:Strings.Dialog_Exception_SubmitReport}" Visibility="Collapsed" />
<ComboBoxItem Content="{x:Static resources:Strings.Dialog_Exception_SubmitReportGithub}" Tag="github" />
<ComboBoxItem Content="{x:Static resources:Strings.Dialog_Exception_SubmitReportDiscord}" Tag="discord" />
</ComboBox>
<Button x:Name="CloseButton" MinWidth="100" Content="{x:Static resources:Strings.Common_Close}" Margin="12,0,0,0" />
</StackPanel>
</Border>
</Grid>
</ui:UiWindow>
</base:WpfUiWindow>

View File

@ -18,10 +18,7 @@ namespace Bloxstrap.UI.Elements.Dialogs
{
public ExceptionDialog(Exception exception)
{
Exception? innerException = exception.InnerException;
InitializeComponent();
AddException(exception);
if (!App.Logger.Initialized)
@ -35,21 +32,6 @@ namespace Bloxstrap.UI.Elements.Dialogs
Clipboard.SetDataObject(String.Join("\r\n", App.Logger.Backlog));
};
ReportOptions.DropDownClosed += (sender, e) =>
{
if (ReportOptions.SelectedItem is not ComboBoxItem comboBoxItem)
return;
ReportOptions.SelectedIndex = 0;
string? tag = comboBoxItem.Tag?.ToString();
if (tag == "github")
Utilities.ShellExecute($"https://github.com/{App.ProjectRepository}/issues");
else if (tag == "discord")
Utilities.ShellExecute("https://discord.gg/nKjV3mGq6R");
};
CloseButton.Click += delegate
{
Close();