diff --git a/SPTInstaller/CustomControls/PreCheckDetails.axaml b/SPTInstaller/CustomControls/PreCheckDetails.axaml
index 676448c..2987bb3 100644
--- a/SPTInstaller/CustomControls/PreCheckDetails.axaml
+++ b/SPTInstaller/CustomControls/PreCheckDetails.axaml
@@ -5,38 +5,44 @@
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 c248d3e..68611ba 100644
--- a/SPTInstaller/CustomControls/PreCheckDetails.axaml.cs
+++ b/SPTInstaller/CustomControls/PreCheckDetails.axaml.cs
@@ -1,6 +1,7 @@
-using System.Windows.Input;
+using System.Collections.ObjectModel;
using Avalonia;
using Avalonia.Controls;
+using SPTInstaller.Models;
namespace SPTInstaller.CustomControls;
@@ -11,57 +12,21 @@ public partial class PreCheckDetails : UserControl
InitializeComponent();
}
- public static readonly StyledProperty PreCheckNameProperty =
- AvaloniaProperty.Register(nameof(PreCheckName));
+ public static readonly StyledProperty> PreChecksProperty =
+ AvaloniaProperty.Register>(nameof(PreChecks));
- public string PreCheckName
+ public ObservableCollection PreChecks
{
- get => GetValue(PreCheckNameProperty);
- set => SetValue(PreCheckNameProperty, value);
+ get => GetValue(PreChecksProperty);
+ set => SetValue(PreChecksProperty, value);
}
- public static readonly StyledProperty DetailsProperty =
- AvaloniaProperty.Register(nameof(Details));
+ public static readonly StyledProperty SelectedIndexProperty =
+ AvaloniaProperty.Register(nameof(SelectedIndex));
- public string Details
+ public int SelectedIndex
{
- get => GetValue(DetailsProperty);
- set => SetValue(DetailsProperty, value);
- }
-
- public static readonly StyledProperty ActionButtonTextProperty =
- AvaloniaProperty.Register(nameof(ActionButtonText));
-
- public string ActionButtonText
- {
- get => GetValue(ActionButtonTextProperty);
- set => SetValue(ActionButtonTextProperty, value);
- }
-
- public static readonly StyledProperty ActionCommandProperty =
- AvaloniaProperty.Register(nameof(ActionCommand));
-
- public ICommand ActionCommand
- {
- get => GetValue(ActionCommandProperty);
- set => SetValue(ActionCommandProperty, value);
- }
-
- public static readonly StyledProperty ShowActionProperty =
- AvaloniaProperty.Register(nameof(ShowAction));
-
- public bool ShowAction
- {
- get => GetValue(ShowActionProperty);
- set => SetValue(ShowActionProperty, value);
- }
-
- public static readonly StyledProperty BarColorProperty =
- AvaloniaProperty.Register(nameof(BarColor));
-
- public string BarColor
- {
- get => GetValue(BarColorProperty);
- set => SetValue(BarColorProperty, value);
+ get => GetValue(SelectedIndexProperty);
+ set => SetValue(SelectedIndexProperty, value);
}
}
\ No newline at end of file
diff --git a/SPTInstaller/ViewModels/PreChecksViewModel.cs b/SPTInstaller/ViewModels/PreChecksViewModel.cs
index 265669f..939fa56 100644
--- a/SPTInstaller/ViewModels/PreChecksViewModel.cs
+++ b/SPTInstaller/ViewModels/PreChecksViewModel.cs
@@ -19,7 +19,13 @@ namespace SPTInstaller.ViewModels;
public class PreChecksViewModel : ViewModelBase
{
- public PreCheckDetailInfo SelectedPreCheck { get; set; } = new();
+ private int _selectedPreCheckIndex;
+
+ public int SelectedPreCheckIndex
+ {
+ get => _selectedPreCheckIndex;
+ set => this.RaiseAndSetIfChanged(ref _selectedPreCheckIndex, value);
+ }
public ObservableCollection PreChecks { get; set; } = new(ServiceHelper.GetAll());
@@ -202,30 +208,8 @@ public class PreChecksViewModel : ViewModelBase
if (check.Id == precheck.Id)
{
precheck.IsSelected = true;
- SelectedPreCheck.Name = precheck.Name;
- SelectedPreCheck.Details = precheck.PreCheckDetails;
- SelectedPreCheck.ActionButtonText = precheck.ActionButtonText;
- SelectedPreCheck.ActionButtonCommand = precheck.ActionButtonCommand;
- SelectedPreCheck.ShowActionButton = precheck.ActionButtonIsVisible;
- switch (precheck.State)
- {
- case StatusSpinner.SpinnerState.Pending:
- SelectedPreCheck.BarColor = "gray";
- break;
- case StatusSpinner.SpinnerState.Running:
- SelectedPreCheck.BarColor = "dodgerblue";
- break;
- case StatusSpinner.SpinnerState.OK:
- SelectedPreCheck.BarColor = "forestgreen";
- break;
- case StatusSpinner.SpinnerState.Warning:
- SelectedPreCheck.BarColor = "gold";
- break;
- case StatusSpinner.SpinnerState.Error:
- SelectedPreCheck.BarColor = "red";
- break;
- }
+ SelectedPreCheckIndex = PreChecks.IndexOf(precheck);
continue;
}
diff --git a/SPTInstaller/Views/PreChecksView.axaml b/SPTInstaller/Views/PreChecksView.axaml
index f7aac04..0570535 100644
--- a/SPTInstaller/Views/PreChecksView.axaml
+++ b/SPTInstaller/Views/PreChecksView.axaml
@@ -20,14 +20,10 @@
/>
-
+