adding cachinfo and spinner controls (WIP)
This commit is contained in:
parent
ea771037af
commit
d8d442c195
@ -211,20 +211,4 @@
|
|||||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||||
<Setter Property="BorderThickness" Value="0"/>
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- PreCheck Path Styles -->
|
|
||||||
<Style Selector="Path.passed">
|
|
||||||
<Setter Property="Data" Value="{StaticResource CircledCheck}"/>
|
|
||||||
<Setter Property="Fill" Value="Green"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="Path.failed">
|
|
||||||
<Setter Property="Data" Value="{StaticResource CircledX}"/>
|
|
||||||
<Setter Property="Fill" Value="Red"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="Path.warning">
|
|
||||||
<Setter Property="Data" Value="{StaticResource CircledWarn}"/>
|
|
||||||
<Setter Property="Fill" Value="Goldenrod"/>
|
|
||||||
</Style>
|
|
||||||
</Styles>
|
</Styles>
|
@ -0,0 +1,26 @@
|
|||||||
|
using Avalonia.Data.Converters;
|
||||||
|
using SPTInstaller.CustomControls;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace SPTInstaller.Converters;
|
||||||
|
public class StatusSpinnerIsProcessingConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is not StatusSpinner.SpinnerState state)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
if (parameter is string parm && parm == "invert")
|
||||||
|
{
|
||||||
|
return state > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
26
SPTInstaller/Converters/StatusSpinnerIsStateConverter.cs
Normal file
26
SPTInstaller/Converters/StatusSpinnerIsStateConverter.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using Avalonia.Data.Converters;
|
||||||
|
using SPTInstaller.CustomControls;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace SPTInstaller.Converters;
|
||||||
|
public class StatusSpinnerIsStateConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null || parameter == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (value is not StatusSpinner.SpinnerState state)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (parameter is not string stateName)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return state.ToString().ToLower() == stateName.ToLower();
|
||||||
|
}
|
||||||
|
|
||||||
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
8
SPTInstaller/CustomControls/CacheInfo.axaml
Normal file
8
SPTInstaller/CustomControls/CacheInfo.axaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
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"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="SPTInstaller.CustomControls.CacheInfo">
|
||||||
|
Welcome to Avalonia!
|
||||||
|
</UserControl>
|
10
SPTInstaller/CustomControls/CacheInfo.axaml.cs
Normal file
10
SPTInstaller/CustomControls/CacheInfo.axaml.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace SPTInstaller.CustomControls;
|
||||||
|
public partial class CacheInfo : UserControl
|
||||||
|
{
|
||||||
|
public CacheInfo()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
@ -36,7 +36,7 @@
|
|||||||
IsVisible="{Binding !IsPending, RelativeSource={RelativeSource AncestorType=UserControl}}">
|
IsVisible="{Binding !IsPending, RelativeSource={RelativeSource AncestorType=UserControl}}">
|
||||||
<Ellipse Fill="White" Height="15" Width="15" Canvas.Top="3" Canvas.Left="3"
|
<Ellipse Fill="White" Height="15" Width="15" Canvas.Top="3" Canvas.Left="3"
|
||||||
/>
|
/>
|
||||||
<Path Name="iconPath" StrokeThickness="2"
|
<Path StrokeThickness="2"
|
||||||
Classes.passed="{Binding Passed, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
Classes.passed="{Binding Passed, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||||
>
|
>
|
||||||
<Classes.failed>
|
<Classes.failed>
|
||||||
|
77
SPTInstaller/CustomControls/StatusSpinner.axaml
Normal file
77
SPTInstaller/CustomControls/StatusSpinner.axaml
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
|
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:convt="using:SPTInstaller.Converters"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="SPTInstaller.CustomControls.StatusSpinner"
|
||||||
|
>
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<convt:StatusSpinnerIsStateConverter x:Key="IsStateConverter"/>
|
||||||
|
<convt:StatusSpinnerIsProcessingConverter x:Key="IsInProcessingStateConverter"/>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<UserControl.Styles>
|
||||||
|
<Style Selector="Arc.running">
|
||||||
|
<Setter Property="Stroke" Value="DodgerBlue"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Path.ok">
|
||||||
|
<Setter Property="Data" Value="{StaticResource CircledCheck}"/>
|
||||||
|
<Setter Property="Fill" Value="Green"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Path.warning">
|
||||||
|
<Setter Property="Data" Value="{StaticResource CircledWarn}"/>
|
||||||
|
<Setter Property="Fill" Value="Goldenrod"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Path.error">
|
||||||
|
<Setter Property="Data" Value="{StaticResource CircledX}"/>
|
||||||
|
<Setter Property="Fill" Value="Red"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="Arc">
|
||||||
|
<Setter Property="Stroke" Value="Gray"/>
|
||||||
|
<Setter Property="IsVisible" Value="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||||
|
Converter={StaticResource ResourceKey=IsInProcessingStateConverter}}"/>
|
||||||
|
<Style.Animations>
|
||||||
|
<Animation Duration="0:0:1" IterationCount="Infinite">
|
||||||
|
<KeyFrame Cue="0%">
|
||||||
|
<Setter Property="RotateTransform.Angle" Value="0"/>
|
||||||
|
</KeyFrame>
|
||||||
|
<KeyFrame Cue="100%">
|
||||||
|
<Setter Property="RotateTransform.Angle" Value="360"/>
|
||||||
|
</KeyFrame>
|
||||||
|
</Animation>
|
||||||
|
</Style.Animations>
|
||||||
|
</Style>
|
||||||
|
</UserControl.Styles>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Canvas Margin="0 3 0 0" Height="20" Width="20"
|
||||||
|
IsVisible="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||||
|
Converter={StaticResource ResourceKey=IsInProcessingStateConverter}, ConverterParameter=invert}">
|
||||||
|
<Ellipse Fill="White" Height="15" Width="15" Canvas.Top="3" Canvas.Left="3"
|
||||||
|
/>
|
||||||
|
<Path StrokeThickness="2"
|
||||||
|
Classes.ok="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||||
|
Converter={StaticResource ResourceKey=IsStateConverter},
|
||||||
|
ConverterParameter=OK}"
|
||||||
|
Classes.warning="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||||
|
Converter={StaticResource ResourceKey=IsStateConverter},
|
||||||
|
ConverterParameter=Warning}"
|
||||||
|
Classes.error="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||||
|
Converter={StaticResource ResourceKey=IsStateConverter},
|
||||||
|
ConverterParameter=Error}"
|
||||||
|
/>
|
||||||
|
</Canvas>
|
||||||
|
|
||||||
|
<Arc StartAngle="280" SweepAngle="80" Margin="0 3 0 0" StrokeThickness="3"
|
||||||
|
Width="20" Height="20" VerticalAlignment="Top"
|
||||||
|
Classes.running="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||||
|
Converter={StaticResource ResourceKey=IsStateConverter},
|
||||||
|
ConverterParameter=Running}"
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
31
SPTInstaller/CustomControls/StatusSpinner.axaml.cs
Normal file
31
SPTInstaller/CustomControls/StatusSpinner.axaml.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.ReactiveUI;
|
||||||
|
|
||||||
|
namespace SPTInstaller.CustomControls;
|
||||||
|
|
||||||
|
public partial class StatusSpinner : ReactiveUserControl<UserControl>
|
||||||
|
{
|
||||||
|
public enum SpinnerState
|
||||||
|
{
|
||||||
|
Pending = -1,
|
||||||
|
Running = 0,
|
||||||
|
OK = 1,
|
||||||
|
Warning = 2,
|
||||||
|
Error = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
public StatusSpinner()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpinnerState State
|
||||||
|
{
|
||||||
|
get => GetValue(StateProperty);
|
||||||
|
set => SetValue(StateProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly StyledProperty<SpinnerState> StateProperty =
|
||||||
|
AvaloniaProperty.Register<StatusSpinner, SpinnerState>(nameof(State));
|
||||||
|
}
|
@ -26,7 +26,7 @@
|
|||||||
IsEnabled="{Binding AllowInstall}"
|
IsEnabled="{Binding AllowInstall}"
|
||||||
Command="{Binding StartInstallCommand}"
|
Command="{Binding StartInstallCommand}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ItemsControl ItemsSource="{Binding PreChecks}" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="4" HorizontalAlignment="Center">
|
<ItemsControl ItemsSource="{Binding PreChecks}" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="4" HorizontalAlignment="Center">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
@ -44,6 +44,7 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
|
||||||
<Button Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3" HorizontalAlignment="Center"
|
<Button Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3" HorizontalAlignment="Center"
|
||||||
Content="Detailed View"
|
Content="Detailed View"
|
||||||
IsEnabled="{Binding AllowDetailsButton}"
|
IsEnabled="{Binding AllowDetailsButton}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user