launch error display

This commit is contained in:
Nathan
2025-12-17 17:18:27 -07:00
parent 84a518a9c9
commit 188d74c072
7 changed files with 21351 additions and 19 deletions

37
Views/ErrorDialog.axaml Normal file
View File

@@ -0,0 +1,37 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="UnifiedFarmLauncher.Views.ErrorDialog"
Title="Error"
Width="700"
Height="500"
MinWidth="500"
MinHeight="300"
WindowStartupLocation="CenterOwner">
<Grid RowDefinitions="Auto,*,Auto" Margin="15">
<!-- Header with icon and title -->
<StackPanel Orientation="Horizontal" Grid.Row="0" Margin="0,0,0,15">
<TextBlock Text="❌" FontSize="24" VerticalAlignment="Center" Margin="0,0,10,0"/>
<TextBlock Text="Error" FontSize="18" FontWeight="Bold" VerticalAlignment="Center"/>
</StackPanel>
<!-- Scrollable error content -->
<ScrollViewer Grid.Row="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<Border>
<TextBlock x:Name="ErrorTextBlock"
TextWrapping="Wrap"
FontFamily="Consolas, Courier New, monospace"
FontSize="12"/>
</Border>
</ScrollViewer>
<!-- OK Button -->
<Button Grid.Row="2"
Content="OK"
HorizontalAlignment="Right"
Width="80"
Margin="0,15,0,0"
Click="OkButton_Click"/>
</Grid>
</Window>

View File

@@ -0,0 +1,23 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
namespace UnifiedFarmLauncher.Views
{
public partial class ErrorDialog : Window
{
public ErrorDialog()
{
InitializeComponent();
}
public ErrorDialog(string errorMessage) : this()
{
this.FindControl<TextBlock>("ErrorTextBlock")!.Text = errorMessage;
}
private void OkButton_Click(object? sender, RoutedEventArgs e)
{
Close();
}
}
}

View File

@@ -128,10 +128,8 @@ namespace UnifiedFarmLauncher.Views
}
catch (System.Exception ex)
{
var errorBox = MessageBoxManager.GetMessageBoxStandard("Error",
$"Failed to start worker: {ex.Message}",
ButtonEnum.Ok, MsBox.Avalonia.Enums.Icon.Error);
await errorBox.ShowAsync();
var errorDialog = new ErrorDialog($"Failed to start worker: {ex.Message}");
await errorDialog.ShowDialog(this);
}
}
}
@@ -171,10 +169,8 @@ namespace UnifiedFarmLauncher.Views
}
catch (System.Exception ex)
{
var errorBox = MessageBoxManager.GetMessageBoxStandard("Error",
$"Failed to stop worker: {ex.Message}",
ButtonEnum.Ok, MsBox.Avalonia.Enums.Icon.Error);
await errorBox.ShowAsync();
var errorDialog = new ErrorDialog($"Failed to stop worker: {ex.Message}");
await errorDialog.ShowDialog(this);
}
}
}
@@ -210,10 +206,8 @@ namespace UnifiedFarmLauncher.Views
}
catch (System.Exception ex)
{
var errorBox = MessageBoxManager.GetMessageBoxStandard("Error",
$"Failed to attach to worker: {ex.Message}",
ButtonEnum.Ok, MsBox.Avalonia.Enums.Icon.Error);
await errorBox.ShowAsync();
var errorDialog = new ErrorDialog($"Failed to attach to worker: {ex.Message}");
await errorDialog.ShowDialog(this);
}
}
}