74 lines
3.8 KiB
Plaintext
Raw Normal View History

<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"
2024-05-01 10:31:55 -04:00
x:Class="SPTInstaller.CustomControls.StatusSpinner">
<UserControl.Resources>
2024-05-01 10:31:55 -04:00
<convt:StatusSpinnerIsStateConverter x:Key="IsStateConverter" />
<convt:StatusSpinnerIsProcessingConverter x:Key="IsInProcessingStateConverter" />
</UserControl.Resources>
<UserControl.Styles>
<Style Selector="Arc.running">
2024-05-01 10:31:55 -04:00
<Setter Property="Stroke" Value="DodgerBlue" />
</Style>
<Style Selector="Path.ok">
2024-05-01 10:31:55 -04:00
<Setter Property="Data" Value="{StaticResource CircledCheck}" />
<Setter Property="Fill" Value="Green" />
</Style>
<Style Selector="Path.warning">
2024-05-01 10:31:55 -04:00
<Setter Property="Data" Value="{StaticResource CircledWarn}" />
<Setter Property="Fill" Value="Goldenrod" />
</Style>
2024-05-01 10:31:55 -04:00
<Style Selector="Path.error">
2024-05-01 10:31:55 -04:00
<Setter Property="Data" Value="{StaticResource CircledX}" />
<Setter Property="Fill" Value="Red" />
</Style>
<Style Selector="Arc">
2024-05-01 10:31:55 -04:00
<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%">
2024-05-01 10:31:55 -04:00
<Setter Property="RotateTransform.Angle" Value="0" />
</KeyFrame>
<KeyFrame Cue="100%">
2024-05-01 10:31:55 -04:00
<Setter Property="RotateTransform.Angle" Value="360" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
</UserControl.Styles>
2024-05-01 10:31:55 -04:00
<Grid>
<Canvas Margin="0 3 0 0" Height="20" Width="20"
2024-05-01 10:31:55 -04:00
IsVisible="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
Converter={StaticResource ResourceKey=IsInProcessingStateConverter}, ConverterParameter=invert}">
2024-05-01 10:31:55 -04:00
<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},
2024-05-01 10:31:55 -04:00
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},
2024-05-01 10:31:55 -04:00
ConverterParameter=Running}" />
</Grid>
2024-05-01 10:31:55 -04:00
</UserControl>