diff --git a/SPTInstaller/Converters/StateSpinnerStateToColorConverter.cs b/SPTInstaller/Converters/StateSpinnerStateToColorConverter.cs
new file mode 100644
index 0000000..685e963
--- /dev/null
+++ b/SPTInstaller/Converters/StateSpinnerStateToColorConverter.cs
@@ -0,0 +1,39 @@
+using System.Globalization;
+using Avalonia.Data.Converters;
+using Avalonia.Media;
+using SPTInstaller.CustomControls;
+
+namespace SPTInstaller.Converters;
+
+public class StateSpinnerStateToColorConverter : IValueConverter
+{
+ public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value == null)
+ return null;
+
+ if (value is not StatusSpinner.SpinnerState state)
+ return null;
+
+ switch (state)
+ {
+ case StatusSpinner.SpinnerState.Pending:
+ return new SolidColorBrush(Colors.Gray);
+ case StatusSpinner.SpinnerState.Running:
+ return new SolidColorBrush(Colors.DodgerBlue);
+ case StatusSpinner.SpinnerState.OK:
+ return new SolidColorBrush(Colors.ForestGreen);
+ case StatusSpinner.SpinnerState.Warning:
+ return new SolidColorBrush(Colors.Goldenrod);
+ case StatusSpinner.SpinnerState.Error:
+ return new SolidColorBrush(Colors.Crimson);
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ return value;
+ }
+}
\ No newline at end of file
diff --git a/SPTInstaller/CustomControls/PreCheckDetails.axaml b/SPTInstaller/CustomControls/PreCheckDetails.axaml
index 2987bb3..0af7991 100644
--- a/SPTInstaller/CustomControls/PreCheckDetails.axaml
+++ b/SPTInstaller/CustomControls/PreCheckDetails.axaml
@@ -2,47 +2,60 @@
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:model="using:SPTInstaller.Models"
+ xmlns:cvt="using:SPTInstaller.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPTInstaller.CustomControls.PreCheckDetails">
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SPTInstaller/CustomControls/PreCheckDetails.axaml.cs b/SPTInstaller/CustomControls/PreCheckDetails.axaml.cs
index 68611ba..a5f8b30 100644
--- a/SPTInstaller/CustomControls/PreCheckDetails.axaml.cs
+++ b/SPTInstaller/CustomControls/PreCheckDetails.axaml.cs
@@ -21,12 +21,12 @@ public partial class PreCheckDetails : UserControl
set => SetValue(PreChecksProperty, value);
}
- public static readonly StyledProperty SelectedIndexProperty =
- AvaloniaProperty.Register(nameof(SelectedIndex));
+ public static readonly StyledProperty HasSelectionProperty =
+ AvaloniaProperty.Register(nameof(HasSelection));
- public int SelectedIndex
+ public bool HasSelection
{
- get => GetValue(SelectedIndexProperty);
- set => SetValue(SelectedIndexProperty, value);
+ get => GetValue(HasSelectionProperty);
+ set => SetValue(HasSelectionProperty, value);
}
}
\ No newline at end of file
diff --git a/SPTInstaller/ViewModels/PreChecksViewModel.cs b/SPTInstaller/ViewModels/PreChecksViewModel.cs
index 939fa56..a60b2e9 100644
--- a/SPTInstaller/ViewModels/PreChecksViewModel.cs
+++ b/SPTInstaller/ViewModels/PreChecksViewModel.cs
@@ -19,12 +19,12 @@ namespace SPTInstaller.ViewModels;
public class PreChecksViewModel : ViewModelBase
{
- private int _selectedPreCheckIndex;
+ private bool _hasPreCheckSelected;
- public int SelectedPreCheckIndex
+ public bool HasPreCheckSelected
{
- get => _selectedPreCheckIndex;
- set => this.RaiseAndSetIfChanged(ref _selectedPreCheckIndex, value);
+ get => _hasPreCheckSelected;
+ set => this.RaiseAndSetIfChanged(ref _hasPreCheckSelected, value);
}
public ObservableCollection PreChecks { get; set; } = new(ServiceHelper.GetAll());
@@ -209,7 +209,7 @@ public class PreChecksViewModel : ViewModelBase
{
precheck.IsSelected = true;
- SelectedPreCheckIndex = PreChecks.IndexOf(precheck);
+ HasPreCheckSelected = true;
continue;
}
diff --git a/SPTInstaller/Views/PreChecksView.axaml b/SPTInstaller/Views/PreChecksView.axaml
index 0570535..fda83d3 100644
--- a/SPTInstaller/Views/PreChecksView.axaml
+++ b/SPTInstaller/Views/PreChecksView.axaml
@@ -22,7 +22,7 @@