mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Enhance the error experience (#3259)
* set taskbar state to error upon failing * add version text to the exception dialog * vertically align version text
This commit is contained in:
parent
8babc09af8
commit
8c5a004732
@ -1,6 +1,7 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Shell;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
@ -35,6 +36,8 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
public static string Version = Assembly.GetExecutingAssembly().GetName().Version!.ToString()[..^2];
|
public static string Version = Assembly.GetExecutingAssembly().GetName().Version!.ToString()[..^2];
|
||||||
|
|
||||||
|
public static Bootstrapper? Bootstrapper { get; set; } = null!;
|
||||||
|
|
||||||
public static bool IsActionBuild => !String.IsNullOrEmpty(BuildMetadata.CommitRef);
|
public static bool IsActionBuild => !String.IsNullOrEmpty(BuildMetadata.CommitRef);
|
||||||
|
|
||||||
public static bool IsProductionBuild => IsActionBuild && BuildMetadata.CommitRef.StartsWith("tag", StringComparison.Ordinal);
|
public static bool IsProductionBuild => IsActionBuild && BuildMetadata.CommitRef.StartsWith("tag", StringComparison.Ordinal);
|
||||||
@ -104,6 +107,14 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
_showingExceptionDialog = true;
|
_showingExceptionDialog = true;
|
||||||
|
|
||||||
|
if (Bootstrapper?.Dialog != null)
|
||||||
|
{
|
||||||
|
if (Bootstrapper.Dialog.TaskbarProgressValue == 0)
|
||||||
|
Bootstrapper.Dialog.TaskbarProgressValue = 1; // make sure it's visible
|
||||||
|
|
||||||
|
Bootstrapper.Dialog.TaskbarProgressState = TaskbarItemProgressState.Error;
|
||||||
|
}
|
||||||
|
|
||||||
Frontend.ShowExceptionDialog(ex);
|
Frontend.ShowExceptionDialog(ex);
|
||||||
|
|
||||||
Terminate(ErrorCode.ERROR_INSTALL_FAILURE);
|
Terminate(ErrorCode.ERROR_INSTALL_FAILURE);
|
||||||
|
@ -202,18 +202,18 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
// start bootstrapper and show the bootstrapper modal if we're not running silently
|
// start bootstrapper and show the bootstrapper modal if we're not running silently
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper");
|
App.Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper");
|
||||||
var bootstrapper = new Bootstrapper(launchMode);
|
App.Bootstrapper = new Bootstrapper(launchMode);
|
||||||
IBootstrapperDialog? dialog = null;
|
IBootstrapperDialog? dialog = null;
|
||||||
|
|
||||||
if (!App.LaunchSettings.QuietFlag.Active)
|
if (!App.LaunchSettings.QuietFlag.Active)
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper dialog");
|
App.Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper dialog");
|
||||||
dialog = App.Settings.Prop.BootstrapperStyle.GetNew();
|
dialog = App.Settings.Prop.BootstrapperStyle.GetNew();
|
||||||
bootstrapper.Dialog = dialog;
|
App.Bootstrapper.Dialog = dialog;
|
||||||
dialog.Bootstrapper = bootstrapper;
|
dialog.Bootstrapper = App.Bootstrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
Task.Run(bootstrapper.Run).ContinueWith(t =>
|
Task.Run(App.Bootstrapper.Run).ContinueWith(t =>
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Bootstrapper task has finished");
|
App.Logger.WriteLine(LOG_IDENT, "Bootstrapper task has finished");
|
||||||
|
|
||||||
|
9
Bloxstrap/Resources/Strings.Designer.cs
generated
9
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -974,6 +974,15 @@ namespace Bloxstrap.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Version {0}.
|
||||||
|
/// </summary>
|
||||||
|
public static string Dialog_Exception_Version {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Dialog.Exception.Version", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to The chosen bootstrapper icon could not be loaded.
|
/// Looks up a localized string similar to The chosen bootstrapper icon could not be loaded.
|
||||||
///
|
///
|
||||||
|
@ -1236,4 +1236,7 @@ Would you like to enable test mode?</value>
|
|||||||
<value>Icons</value>
|
<value>Icons</value>
|
||||||
<comment>Name of the folder that gets created according to the "create shortcut icons" option. Ensure that it is a valid folder name.</comment>
|
<comment>Name of the folder that gets created according to the "create shortcut icons" option. Ensure that it is a valid folder name.</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Dialog.Exception.Version" xml:space="preserve">
|
||||||
|
<value>Version {0}</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -40,11 +40,15 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Border Grid.Row="2" Padding="15" Background="{ui:ThemeResource SolidBackgroundFillColorSecondaryBrush}">
|
<Border Grid.Row="2" Padding="15" Background="{ui:ThemeResource SolidBackgroundFillColorSecondaryBrush}">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock x:Name="VersionText" VerticalAlignment="Center" HorizontalAlignment="Left" Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="Version 2.8.0" />
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" FlowDirection="LeftToRight" HorizontalAlignment="Right">
|
<StackPanel Orientation="Horizontal" FlowDirection="LeftToRight" HorizontalAlignment="Right">
|
||||||
<Button x:Name="ReportExceptionButton" Content="{x:Static resources:Strings.Dialog_Exception_Report}" />
|
<Button x:Name="ReportExceptionButton" Content="{x:Static resources:Strings.Dialog_Exception_Report}" />
|
||||||
<Button x:Name="LocateLogFileButton" Content="{x:Static resources:Strings.Common_OpenLogFile}" Margin="12,0,0,0" />
|
<Button x:Name="LocateLogFileButton" Content="{x:Static resources:Strings.Common_OpenLogFile}" Margin="12,0,0,0" />
|
||||||
<Button x:Name="CloseButton" MinWidth="100" Content="{x:Static resources:Strings.Common_Close}" Margin="12,0,0,0" />
|
<Button x:Name="CloseButton" MinWidth="100" Content="{x:Static resources:Strings.Common_Close}" Margin="12,0,0,0" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</base:WpfUiWindow>
|
</base:WpfUiWindow>
|
||||||
|
@ -40,6 +40,8 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
|||||||
helpMessage = String.Format(Strings.Dialog_Exception_Info_2_Alt, wikiUrl);
|
helpMessage = String.Format(Strings.Dialog_Exception_Info_2_Alt, wikiUrl);
|
||||||
|
|
||||||
HelpMessageMDTextBlock.MarkdownText = helpMessage;
|
HelpMessageMDTextBlock.MarkdownText = helpMessage;
|
||||||
|
VersionText.Text = String.Format(Strings.Dialog_Exception_Version, App.Version);
|
||||||
|
|
||||||
ReportExceptionButton.Click += (_, _) => Utilities.ShellExecute(issueUrl);
|
ReportExceptionButton.Click += (_, _) => Utilities.ShellExecute(issueUrl);
|
||||||
|
|
||||||
LocateLogFileButton.Click += delegate
|
LocateLogFileButton.Click += delegate
|
||||||
|
Loading…
Reference in New Issue
Block a user