Skip to content

Commit

Permalink
Revise exception help message
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Jul 5, 2024
1 parent 6eebb54 commit b336658
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 64 deletions.
31 changes: 3 additions & 28 deletions Bloxstrap/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 3 additions & 10 deletions Bloxstrap/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
14 changes: 6 additions & 8 deletions Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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>
18 changes: 0 additions & 18 deletions Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ public partial class ExceptionDialog
{
public ExceptionDialog(Exception exception)
{
Exception? innerException = exception.InnerException;

InitializeComponent();

AddException(exception);

if (!App.Logger.Initialized)
Expand All @@ -35,21 +32,6 @@ public ExceptionDialog(Exception exception)
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();
Expand Down

0 comments on commit b336658

Please sign in to comment.