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 676448c..0af7991 100644 --- a/SPTInstaller/CustomControls/PreCheckDetails.axaml +++ b/SPTInstaller/CustomControls/PreCheckDetails.axaml @@ -2,41 +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"> + + + + + - +