Merge pull request 'master' (#9) from CWX/SPT-AKI-Installer:master into master
Reviewed-on: waffle.lord/SPT-AKI-Installer#9
This commit is contained in:
commit
67fcab23b1
@ -38,5 +38,7 @@
|
||||
/>
|
||||
<PathGeometry x:Key="CircledWarn" Figures="M 9.4328769 0.04019892 C 7.0982838 0.34605265 4.9864964 0.9947734 3.2144923 2.6416847 -0.51716071 6.1098902 -1.0931625 11.937378 1.9776592 16.023146 c 0.6666064 0.886919 1.4893703 1.657003 2.4101133 2.276223 0.9414784 0.633151 1.9874973 1.110834 3.0896371 1.387001 1.2547837 0.314488 2.5508664 0.396281 3.8327134 0.22809 4.776463 -0.626673 8.470809 -4.727503 8.680748 -9.510654 C 20.200809 5.6204614 16.766697 1.2560532 12.09231 0.24958776 11.252125 0.06868514 10.291794 -0.07233093 9.4328769 0.04019892 M 9.784861 4.2119583 c 0.934085 -0.1667851 1.016841 0.6682722 1.016841 1.352973 v 5.1120367 c 0 0.62605 0.190424 1.671637 -0.664858 1.821253 C 9.2424915 12.654703 9.1591106 11.781677 9.1591106 11.145248 V 6.0332096 c 0 -0.6032595 -0.201139 -1.6735876 0.6257504 -1.8212513 m 0 9.9899357 c 1.062442 -0.189692 1.447474 1.424659 0.391092 1.613298 -1.0624433 0.189692 -1.4474743 -1.424659 -0.391092 -1.613298 z" FillRule="NonZero"
|
||||
/>
|
||||
<PathGeometry x:Key="Cache" Figures="M 5.4515409 18.707476 C 2.8719183 18.411612 0.6356275 17.508046 0.12886774 16.556868 0.011421 16.336424 0 16.17685 0 14.75659 v -1.558391 l 0.20348761 0.163959 c 0.89061819 0.717606 2.90294209 1.394851 4.91765599 1.655024 1.0475327 0.135279 3.5115239 0.155131 4.4933927 0.03621 2.1668367 -0.262447 3.9985147 -0.826312 5.0629357 -1.558573 l 0.322527 -0.221877 v 1.524757 c 0 1.755973 -0.0041 1.772626 -0.56529 2.263709 -0.796666 0.697209 -2.144167 1.203544 -4.0933 1.53809 -0.5767809 0.099 -1.1020996 0.129287 -2.5440527 0.146688 -0.9994482 0.01206 -2.0550657 -0.0054 -2.3458154 -0.0387 z M 7.8601306 17.28745 c 0.0527 -0.04941 0.095816 -0.193581 0.095816 -0.320366 0 -0.405037 -0.46603 -0.61585 -0.7533032 -0.340767 -0.1321068 0.126504 -0.1782781 0.469731 -0.081588 0.606525 0.1545094 0.218594 0.5342719 0.246654 0.7390756 0.05461 z M 5.5458634 17.092351 c 0.075327 -0.0917 0.1369546 -0.21599 0.1369546 -0.276208 0 -0.203883 -0.2583299 -0.442927 -0.478668 -0.442927 -0.2881074 0 -0.4464405 0.159294 -0.4464405 0.449148 0 0.424533 0.5160004 0.601292 0.7881539 0.269987 z m 4.7625076 0.04017 c 0.07342 -0.0703 0.132157 -0.210917 0.132157 -0.316377 0 -0.105459 -0.05874 -0.24607 -0.132157 -0.316375 -0.07342 -0.0703 -0.220267 -0.126552 -0.3303979 -0.126552 -0.1101318 0 -0.2569762 0.05625 -0.3303975 0.126552 -0.073421 0.0703 -0.1321569 0.210916 -0.1321569 0.316375 0 0.10546 0.058738 0.246072 0.1321569 0.316377 0.073421 0.07031 0.2202657 0.126551 0.3303975 0.126551 0.1101309 0 0.2569759 -0.05624 0.3303979 -0.126551 z M 6.4427306 14.219282 C 3.438293 14.06843 0.69941831 13.09766 0.13645011 11.98407 0.00570426 11.725447 -0.00143606 11.622911 0.01527712 10.244516 L 0.03303424 8.7797875 0.36343157 9.0065262 C 2.6575042 10.580863 7.8536269 11.112097 11.747571 10.170399 12.962111 9.8766787 13.852599 9.520745 14.620039 9.0222575 l 0.379955 -0.2467994 v 1.4852079 c 0 0.822685 -0.02906 1.558392 -0.06514 1.649265 -0.108197 0.272498 -0.66301 0.788548 -1.121691 1.043315 -1.168844 0.64922 -3.065811 1.13473 -4.8263882 1.235267 -1.2569769 0.07178 -1.6359325 0.07636 -2.5440532 0.03076 z m 1.4159088 -1.492928 c 0.075324 -0.0917 0.1369543 -0.215989 0.1369543 -0.276207 0 -0.203883 -0.2583318 -0.442926 -0.4786675 -0.442926 -0.2881093 0 -0.4464425 0.159291 -0.4464425 0.449146 0 0.424534 0.5160019 0.601293 0.7881557 0.269987 z m -2.29146 -0.159368 c 0.1618895 -0.183199 0.1439776 -0.411835 -0.046556 -0.594283 -0.3090962 -0.29598 -0.7629143 -0.107341 -0.7629143 0.317126 0 0.426014 0.5204584 0.604217 0.8094703 0.277157 z m 4.6992386 0.06839 c 0.12628 -0.09512 0.17411 -0.18946 0.17411 -0.343424 0 -0.232297 -0.242217 -0.474564 -0.4744705 -0.474564 -0.1820319 0 -0.4506387 0.282868 -0.4506387 0.474564 0 0.191699 0.2686068 0.474567 0.4506387 0.474567 0.069437 0 0.2046015 -0.05901 0.3003605 -0.131143 z M 5.9140951 9.6877494 C 3.2886712 9.3885406 1.5607385 8.8497481 0.58264334 8.0253262 0.03362115 7.5625637 0 7.4352112 0 5.8183118 V 4.4150124 L 0.30935351 4.6411272 C 1.3355178 5.3911787 3.3497821 5.9987632 5.5506611 6.2221182 6.7548513 6.3443244 9.00242 6.3139162 10.077093 6.1608788 12.027869 5.8830787 13.636 5.3630162 14.620197 4.6916622 14.792913 4.5738469 14.949026 4.4774523 14.967113 4.4774523 14.985194 4.4774523 15 5.1050107 15 5.8720299 15 7.4791794 14.982469 7.5435731 14.411053 8.0355275 13.533871 8.7907237 11.69734 9.3913644 9.5158238 9.6365256 8.7752594 9.71975 6.4811675 9.7523775 5.9140951 9.6877506 Z M 7.7751038 8.4969125 C 8.1763294 8.227805 7.8985219 7.5555425 7.4323869 7.6675706 7.1999381 7.7234394 7.0703688 7.8802994 7.071495 8.104485 7.072745 8.3355694 7.11687 8.4143437 7.3017606 8.5147362 7.4816994 8.6124437 7.610055 8.6076106 7.7751038 8.4969175 Z M 5.5458634 8.2338012 C 5.6211901 8.1421037 5.682818 8.0178119 5.682818 7.9575956 c 0 -0.1899694 -0.2585097 -0.4429287 -0.4526467 -0.4429287 -0.2913367 0 -0.4724618 0.1632037 -0.4724618 0.425715 0 0.2931318 0.1578686 0.4601406 0.4349596 0.4601406 0.154904 0 0.2550881 -0.047287 0.3531943 -0.1667213 z m 4.7625076 0.040175 c 0.07342 -0.070305 0.132157 -0.2109162 0.132157 -0.316375 0 -0.1054612 -0.05874 -0.2460718 -0.132157 -0.3163775 -0.286005 -0.2738662 -0.7929522 -0.071601 -0.7929522 0.3163775 0 0.1054588 0.058737 0.2460694 0.1321568 0.316375 0.073421 0.070304 0.2202657 0.1265519 0.3303975 0.1265519 0.1101309 0 0.2569759 -0.056244 0.3303979 -0.1265519 z M 6.178414 5.3866444 C 3.8630228 5.2033161 2.0080132 4.6795372 0.82192238 3.8741859 0.26331487 3.4948944 0.03303924 3.1533125 0.03303924 2.7039893 c 0 -0.2939821 0.03374352 -0.3937029 0.21156697 -0.6252455 C 1.4428273 0.518552 5.8324898 -0.36375235 9.8724944 0.14357696 12.82408 0.51422624 14.999999 1.6015126 14.999999 2.7057413 c 0 1.1212199 -2.227472 2.2145851 -5.2863421 2.5948303 C 9.1252344 5.3737159 6.74658 5.4316311 6.178414 5.3866444 Z" FillRule="NonZero"
|
||||
/>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
@ -5,7 +5,7 @@
|
||||
>
|
||||
<Design.PreviewWith>
|
||||
<StackPanel Spacing="5" Background="{StaticResource AKI_Background_Dark}">
|
||||
<Button Content="Blah" Classes="outlinedTLCorner"/>
|
||||
<Button Content="Blah" Classes="link"/>
|
||||
<TextBox Text="Some cool text here" Margin="5"/>
|
||||
<TextBox Watermark="This is a watermark" Margin="5"/>
|
||||
</StackPanel>
|
||||
@ -190,7 +190,44 @@
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<!-- Button outlinedTLCorner Style -->
|
||||
<!-- Button Link Style -->
|
||||
<Style Selector="Button.link">
|
||||
<Setter Property="Foreground" Value="{StaticResource AKI_Brush_Lighter}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0 0 0 1"/>
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding $parent[Button].Content}" TextDecorations="Underline"/>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.link:pointerover TextBlock">
|
||||
<Setter Property="Foreground" Value="{StaticResource AKI_Brush_Yellow}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.link:pressed TextBlock">
|
||||
<Setter Property="Foreground" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.link:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="TextBlock.Foreground" Value="{StaticResource AKI_Brush_Yellow}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0 0 0 1"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button.link:pressed /template/ ContentPresenter">
|
||||
<Setter Property="TextBlock.Foreground" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0 0 0 1"/>
|
||||
</Style>
|
||||
|
||||
<!-- Button outlinedTLCorner Style -->
|
||||
<Style Selector="Button.outlinedTLCorner">
|
||||
<Setter Property="Foreground" Value="{StaticResource AKI_Brush_Lighter}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
@ -211,20 +248,4 @@
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
</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>
|
@ -1,5 +1,6 @@
|
||||
using Serilog;
|
||||
using SharpCompress;
|
||||
using SPTInstaller.CustomControls;
|
||||
using SPTInstaller.Interfaces;
|
||||
using SPTInstaller.Models;
|
||||
using System.Collections.Generic;
|
||||
@ -26,7 +27,7 @@ public class InstallController
|
||||
Log.Information("-<>--<>- Running PreChecks -<>--<>-");
|
||||
var requiredResults = new List<IResult>();
|
||||
|
||||
_preChecks.ForEach(x => x.IsPending = true);
|
||||
_preChecks.ForEach(x => x.State = StatusSpinner.SpinnerState.Pending);
|
||||
|
||||
foreach (var check in _preChecks)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
31
SPTInstaller/CustomControls/CacheInfo.axaml
Normal file
31
SPTInstaller/CustomControls/CacheInfo.axaml
Normal file
@ -0,0 +1,31 @@
|
||||
<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:cc="using:SPTInstaller.CustomControls"
|
||||
xmlns:convt="using:SPTInstaller.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SPTInstaller.CustomControls.CacheInfo">
|
||||
<UserControl.Resources>
|
||||
<convt:StatusSpinnerIsProcessingConverter x:Key="IsInProcessingStateConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid ColumnDefinitions="AUTO,10,AUTO,10,AUTO">
|
||||
<cc:StatusSpinner State="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
IsVisible="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||
Converter={StaticResource IsInProcessingStateConverter}}"
|
||||
/>
|
||||
|
||||
<Path Data="{StaticResource Cache}" Fill="DodgerBlue" Margin="0 6 0 0"
|
||||
IsVisible="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||
Converter={StaticResource IsInProcessingStateConverter},
|
||||
ConverterParameter=invert}"
|
||||
/>
|
||||
|
||||
<Label Grid.Column="2" Content="{Binding InfoText, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Margin="0 2 0 0"
|
||||
/>
|
||||
<Button Grid.Column="4" Content="What's this?" Classes="link"
|
||||
Command="{Binding ShowCacheDialogCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
34
SPTInstaller/CustomControls/CacheInfo.axaml.cs
Normal file
34
SPTInstaller/CustomControls/CacheInfo.axaml.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using DialogHostAvalonia;
|
||||
using SPTInstaller.CustomControls.Dialogs;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.CustomControls;
|
||||
public partial class CacheInfo : UserControl
|
||||
{
|
||||
public CacheInfo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public async Task ShowCacheDialogCommand() => await DialogHost.Show(new WhyCacheThoughDialog());
|
||||
|
||||
public string InfoText
|
||||
{
|
||||
get => GetValue(InfoTextProperty);
|
||||
set => SetValue(InfoTextProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string> InfoTextProperty =
|
||||
AvaloniaProperty.Register<CacheInfo, string>(nameof(InfoText));
|
||||
|
||||
public StatusSpinner.SpinnerState State
|
||||
{
|
||||
get => GetValue(StateProperty);
|
||||
set => SetValue(StateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<StatusSpinner.SpinnerState> StateProperty =
|
||||
AvaloniaProperty.Register<CacheInfo, StatusSpinner.SpinnerState>(nameof(State));
|
||||
}
|
@ -2,29 +2,10 @@
|
||||
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:cc="using:SPTInstaller.CustomControls"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SPTInstaller.CustomControls.DetailedPreCheckItem"
|
||||
Background="Transparent" MinHeight="100">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="Arc.running">
|
||||
<Setter Property="Stroke" Value="DodgerBlue"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Arc">
|
||||
<Setter Property="Stroke" Value="Gray"/>
|
||||
<Setter Property="IsVisible" Value="{Binding IsPending, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
|
||||
<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 RowDefinitions="3,AUTO,3,*,30,3" ColumnDefinitions="3,*,AUTO,3" Margin="10">
|
||||
<Border Grid.RowSpan="5" Grid.ColumnSpan="3"
|
||||
@ -35,36 +16,13 @@
|
||||
Background="{StaticResource AKI_Brush_DarkGrayBlue}" CornerRadius="8 8 0 0"
|
||||
/>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="1" ColumnDefinitions="22, AUTO" Margin="3">
|
||||
<Canvas Margin="0 3 0 0"
|
||||
IsVisible="{Binding !IsPending, RelativeSource={RelativeSource AncestorType=UserControl}}">
|
||||
<Ellipse Fill="White" Height="15" Width="15" Canvas.Top="3" Canvas.Left="3"
|
||||
/>
|
||||
<Path Name="iconPath" StrokeThickness="2"
|
||||
Classes.passed="{Binding Passed, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
>
|
||||
<Classes.failed>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="IsRequired"/>
|
||||
<Binding Path="!Passed"/>
|
||||
</MultiBinding>
|
||||
</Classes.failed>
|
||||
<Classes.warning>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="!IsRequired"/>
|
||||
<Binding Path="!Passed"/>
|
||||
</MultiBinding>
|
||||
</Classes.warning>
|
||||
</Path>
|
||||
</Canvas>
|
||||
|
||||
<Arc StartAngle="280" SweepAngle="80" Margin="0 3 0 0" StrokeThickness="3"
|
||||
Width="20" Height="20" VerticalAlignment="Top"
|
||||
Classes.running="{Binding IsRunning, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
/>
|
||||
<Grid Grid.Row="1" Grid.Column="1" ColumnDefinitions="AUTO, AUTO" Margin="3">
|
||||
<cc:StatusSpinner State="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
|
||||
<Label Grid.Column="1"
|
||||
Content="{Binding PreCheckName, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Classes.bold="{Binding IsRunning, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Classes.bold="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
|
||||
Converter={StaticResource ResourceKey=IsStateConverter},
|
||||
ConverterParameter=Running}"
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
<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:helpers="using:SPTInstaller.Helpers"
|
||||
xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SPTInstaller.CustomControls.Dialogs.WhyCacheThoughDialog">
|
||||
<Grid RowDefinitions="AUTO,AUTO,AUTO,*,AUTO" ColumnDefinitions="*,AUTO"
|
||||
Background="{StaticResource AKI_Background_Light}">
|
||||
<Label Content="What is the installer cache for?" FontSize="20"
|
||||
Foreground="{StaticResource AKI_Brush_Yellow}"
|
||||
/>
|
||||
<TextBlock Grid.Row="1" TextWrapping="Wrap" xml:space="preserve">
|
||||
The installer cache is used to ensure you don't re-download large files that you've already downloaded before.
|
||||
<Span Foreground="red">You should only delete the cache folder if</Span>
|
||||
- You are low on space
|
||||
or
|
||||
- You are not planning on installing SPT again any time soon
|
||||
|
||||
If possible, you should leave the cache in place to avoid uneccessary, lengthy downloads.
|
||||
It also helps us prevent extra traffic to our limited download mirrors. Every bit helps <Span Foreground="red" FontSize="25">♥️</Span>
|
||||
</TextBlock>
|
||||
<Label Grid.Row="2" Content="You can find the cache folder here"
|
||||
/>
|
||||
<Button Grid.Row="3" Content="{Binding Source={x:Static helpers:DownloadCacheHelper.CachePath}}"
|
||||
Classes="link"
|
||||
IsVisible="{Binding CacheExists, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Command="{Binding OpenCacheFolder, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
/>
|
||||
<Label Grid.Row="3" Content="No cache folder exists"
|
||||
IsVisible="{Binding !CacheExists, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
/>
|
||||
<Button Grid.Row="4" Grid.Column="1" Content="Close" Classes="yellow"
|
||||
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
@ -0,0 +1,27 @@
|
||||
using Avalonia.Controls;
|
||||
using SPTInstaller.Helpers;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace SPTInstaller.CustomControls.Dialogs;
|
||||
public partial class WhyCacheThoughDialog : UserControl
|
||||
{
|
||||
public WhyCacheThoughDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public bool CacheExists => Directory.Exists(DownloadCacheHelper.CachePath);
|
||||
|
||||
public void OpenCacheFolder()
|
||||
{
|
||||
if (!CacheExists)
|
||||
return;
|
||||
|
||||
Process.Start(new ProcessStartInfo()
|
||||
{
|
||||
FileName = Path.EndsInDirectorySeparator(DownloadCacheHelper.CachePath) ? DownloadCacheHelper.CachePath : DownloadCacheHelper.CachePath + Path.DirectorySeparatorChar,
|
||||
UseShellExecute = true,
|
||||
Verb = "open"
|
||||
});
|
||||
}
|
||||
}
|
@ -2,65 +2,29 @@
|
||||
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:cc="using:SPTInstaller.CustomControls"
|
||||
xmlns:convt="using:SPTInstaller.Converters"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SPTInstaller.CustomControls.PreCheckItem">
|
||||
|
||||
|
||||
<UserControl.Resources>
|
||||
<convt:StatusSpinnerIsStateConverter x:Key="IsStateConverter"/>
|
||||
</UserControl.Resources>
|
||||
<UserControl.Styles>
|
||||
<Style Selector="Arc.running">
|
||||
<Setter Property="Stroke" Value="DodgerBlue"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Arc">
|
||||
<Setter Property="Stroke" Value="Gray"/>
|
||||
<Setter Property="IsVisible" Value="{Binding IsPending, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
|
||||
<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>
|
||||
|
||||
<Style Selector="Label.bold">
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
|
||||
|
||||
<Grid ColumnDefinitions="22, AUTO" Margin="3">
|
||||
<Canvas Margin="0 3 0 0"
|
||||
IsVisible="{Binding !IsPending, RelativeSource={RelativeSource AncestorType=UserControl}}">
|
||||
<Ellipse Fill="White" Height="15" Width="15" Canvas.Top="3" Canvas.Left="3"
|
||||
/>
|
||||
<Path Name="iconPath" StrokeThickness="2"
|
||||
Classes.passed="{Binding Passed, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
>
|
||||
<Classes.failed>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="IsRequired"/>
|
||||
<Binding Path="!Passed"/>
|
||||
</MultiBinding>
|
||||
</Classes.failed>
|
||||
<Classes.warning>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="!IsRequired"/>
|
||||
<Binding Path="!Passed"/>
|
||||
</MultiBinding>
|
||||
</Classes.warning>
|
||||
</Path>
|
||||
</Canvas>
|
||||
|
||||
<Arc StartAngle="280" SweepAngle="80" Margin="0 3 0 0" StrokeThickness="3"
|
||||
Width="20" Height="20" VerticalAlignment="Top"
|
||||
Classes.running="{Binding IsRunning, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
/>
|
||||
<Grid ColumnDefinitions="AUTO, AUTO" Margin="3">
|
||||
<cc:StatusSpinner State="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
|
||||
|
||||
<Label Grid.Column="1"
|
||||
Content="{Binding PreCheckName, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Classes.bold="{Binding IsRunning, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Classes.bold="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl}
|
||||
Converter={StaticResource ResourceKey=IsStateConverter},
|
||||
ConverterParameter=Running}"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using Avalonia;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace SPTInstaller.CustomControls;
|
||||
@ -19,33 +19,6 @@ public partial class PreCheckItem : UserControl
|
||||
public static readonly StyledProperty<string> PreCheckNameProperty =
|
||||
AvaloniaProperty.Register<PreCheckItem, string>(nameof(PreCheckName));
|
||||
|
||||
public bool IsRunning
|
||||
{
|
||||
get => GetValue(IsRunningProperty);
|
||||
set => SetValue(IsRunningProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsRunningProperty =
|
||||
AvaloniaProperty.Register<PreCheckItem, bool>(nameof(IsRunning));
|
||||
|
||||
public bool IsPending
|
||||
{
|
||||
get => GetValue(IsPendingProperty);
|
||||
set => SetValue(IsPendingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsPendingProperty =
|
||||
AvaloniaProperty.Register<PreCheckItem, bool>(nameof(IsPending));
|
||||
|
||||
public bool Passed
|
||||
{
|
||||
get => GetValue(PassedProperty);
|
||||
set => SetValue(PassedProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> PassedProperty =
|
||||
AvaloniaProperty.Register<PreCheckItem, bool>(nameof(Passed));
|
||||
|
||||
public bool IsRequired
|
||||
{
|
||||
get => GetValue(IsRequiredProperty);
|
||||
@ -54,4 +27,13 @@ public partial class PreCheckItem : UserControl
|
||||
|
||||
public static readonly StyledProperty<bool> IsRequiredProperty =
|
||||
AvaloniaProperty.Register<PreCheckItem, bool>(nameof(IsRequired));
|
||||
|
||||
public StatusSpinner.SpinnerState State
|
||||
{
|
||||
get => GetValue(StateProperty);
|
||||
set => SetValue(StateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<StatusSpinner.SpinnerState> StateProperty =
|
||||
AvaloniaProperty.Register<PreCheckItem, StatusSpinner.SpinnerState>(nameof(State));
|
||||
}
|
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));
|
||||
}
|
@ -11,6 +11,21 @@ public static class DownloadCacheHelper
|
||||
|
||||
public static string CachePath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "spt-installer/cache");
|
||||
|
||||
public static string GetCacheSizeText()
|
||||
{
|
||||
if (!Directory.Exists(CachePath))
|
||||
return "No cache folder";
|
||||
|
||||
var cacheDir = new DirectoryInfo(CachePath);
|
||||
|
||||
var cacheSize = DirectorySizeHelper.GetSizeOfDirectory(cacheDir);
|
||||
|
||||
if (cacheSize == 0)
|
||||
return "Empty";
|
||||
|
||||
return DirectorySizeHelper.SizeSuffix(cacheSize);
|
||||
}
|
||||
|
||||
private static bool CheckCache(FileInfo cacheFile, string expectedHash = null)
|
||||
{
|
||||
try
|
||||
|
30
SPTInstaller/Installer Tasks/PreChecks/TestPreCheck.cs
Normal file
30
SPTInstaller/Installer Tasks/PreChecks/TestPreCheck.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using SPTInstaller.CustomControls;
|
||||
using SPTInstaller.Models;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Installer_Tasks.PreChecks;
|
||||
public class TestPreCheck : PreCheckBase
|
||||
{
|
||||
private StatusSpinner.SpinnerState _endState;
|
||||
public static TestPreCheck FromRandomName(StatusSpinner.SpinnerState EndState) => new TestPreCheck($"{EndState} #{new Random().Next(0, 9999)}", EndState == StatusSpinner.SpinnerState.Error, EndState);
|
||||
|
||||
public TestPreCheck(string name, bool isRequired, StatusSpinner.SpinnerState endState) : base(name, isRequired)
|
||||
{
|
||||
_endState = endState;
|
||||
}
|
||||
|
||||
public override async Task<PreCheckResult> CheckOperation()
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
|
||||
switch (_endState)
|
||||
{
|
||||
case StatusSpinner.SpinnerState.Error:
|
||||
return PreCheckResult.FromError("This is what a required precheck failing looks like");
|
||||
case StatusSpinner.SpinnerState.Warning:
|
||||
return PreCheckResult.FromError("This is what a non-required precheck failing looks like");
|
||||
default:
|
||||
return PreCheckResult.FromSuccess("This is what a successful precheck looks like");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using SPTInstaller.CustomControls;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SPTInstaller.Interfaces;
|
||||
|
||||
@ -7,12 +8,8 @@ public interface IPreCheck
|
||||
public string Id { get; }
|
||||
public string Name { get; }
|
||||
public bool IsRequired { get; }
|
||||
|
||||
public bool IsPending { get; set; }
|
||||
|
||||
public bool Passed { get; }
|
||||
|
||||
public string PreCheckDetails { get; }
|
||||
public StatusSpinner.SpinnerState State { get; set; }
|
||||
|
||||
public Task<IResult> RunCheck();
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using ReactiveUI;
|
||||
using SPTInstaller.CustomControls;
|
||||
using SPTInstaller.Interfaces;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
@ -28,25 +29,11 @@ public abstract class PreCheckBase : ReactiveObject, IPreCheck
|
||||
set => this.RaiseAndSetIfChanged(ref _required, value);
|
||||
}
|
||||
|
||||
private bool _passed;
|
||||
public bool Passed
|
||||
private StatusSpinner.SpinnerState _state;
|
||||
public StatusSpinner.SpinnerState State
|
||||
{
|
||||
get => _passed;
|
||||
set => this.RaiseAndSetIfChanged(ref _passed, value);
|
||||
}
|
||||
|
||||
private bool _isPending;
|
||||
public bool IsPending
|
||||
{
|
||||
get => _isPending;
|
||||
set => this.RaiseAndSetIfChanged(ref _isPending, value);
|
||||
}
|
||||
|
||||
private bool _isRunning;
|
||||
public bool IsRunning
|
||||
{
|
||||
get => _isRunning;
|
||||
set => this.RaiseAndSetIfChanged(ref _isRunning, value);
|
||||
get => _state;
|
||||
set => this.RaiseAndSetIfChanged(ref _state, value);
|
||||
}
|
||||
|
||||
private string _preCheckDetails;
|
||||
@ -89,12 +76,19 @@ public abstract class PreCheckBase : ReactiveObject, IPreCheck
|
||||
Id = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
private StatusSpinner.SpinnerState ProcessResult(PreCheckResult result) =>
|
||||
(result.Succeeded, IsRequired) switch
|
||||
{
|
||||
(true, _) => StatusSpinner.SpinnerState.OK,
|
||||
(false, false) => StatusSpinner.SpinnerState.Warning,
|
||||
(_, _) => StatusSpinner.SpinnerState.Error
|
||||
};
|
||||
|
||||
public async Task<IResult> RunCheck()
|
||||
{
|
||||
IsRunning = true;
|
||||
State = StatusSpinner.SpinnerState.Running;
|
||||
|
||||
var result = await CheckOperation();
|
||||
Passed = result.Succeeded;
|
||||
|
||||
PreCheckDetails = !string.IsNullOrWhiteSpace(result.Message)
|
||||
? result.Message
|
||||
@ -104,10 +98,9 @@ public abstract class PreCheckBase : ReactiveObject, IPreCheck
|
||||
ActionButtonCommand = result.ButtonPressedCommand;
|
||||
ActionButtonIsVisible = result.ActionButtonIsVisible;
|
||||
|
||||
IsRunning = false;
|
||||
IsPending = false;
|
||||
State = ProcessResult(result);
|
||||
|
||||
return Passed ? Result.FromSuccess() : Result.FromError($"PreCheck Failed: {Name}");
|
||||
return State == StatusSpinner.SpinnerState.OK ? Result.FromSuccess() : Result.FromError($"PreCheck Failed: {Name}");
|
||||
}
|
||||
|
||||
public abstract Task<PreCheckResult> CheckOperation();
|
||||
|
@ -4,6 +4,7 @@ using ReactiveUI;
|
||||
using Serilog;
|
||||
using Splat;
|
||||
using SPTInstaller.Controllers;
|
||||
using SPTInstaller.CustomControls;
|
||||
using SPTInstaller.Helpers;
|
||||
using SPTInstaller.Installer_Tasks;
|
||||
using SPTInstaller.Installer_Tasks.PreChecks;
|
||||
@ -31,10 +32,11 @@ internal class Program
|
||||
// Register all the things
|
||||
// Regestering as base classes so ReactiveUI works correctly. Doesn't seem to like the interfaces :(
|
||||
ServiceHelper.Register<InternalData>();
|
||||
|
||||
#if !TEST
|
||||
ServiceHelper.Register<PreCheckBase, NetFramework472PreCheck>();
|
||||
ServiceHelper.Register<PreCheckBase, NetCore6PreCheck>();
|
||||
|
||||
#if !TEST
|
||||
ServiceHelper.Register<PreCheckBase, FreeSpacePreCheck>();
|
||||
var logPath = Path.Join(Environment.CurrentDirectory, "spt-aki-installer_.log");
|
||||
|
||||
@ -52,10 +54,14 @@ internal class Program
|
||||
ServiceHelper.Register<InstallerTaskBase, CopyClientTask>();
|
||||
ServiceHelper.Register<InstallerTaskBase, SetupClientTask>();
|
||||
#else
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
Locator.CurrentMutable.RegisterConstant<InstallerTaskBase>(TestTask.FromRandomName());
|
||||
}
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
Locator.CurrentMutable.RegisterConstant<InstallerTaskBase>(TestTask.FromRandomName());
|
||||
}
|
||||
|
||||
Locator.CurrentMutable.RegisterConstant<PreCheckBase>(TestPreCheck.FromRandomName(StatusSpinner.SpinnerState.OK));
|
||||
Locator.CurrentMutable.RegisterConstant<PreCheckBase>(TestPreCheck.FromRandomName(StatusSpinner.SpinnerState.Warning));
|
||||
Locator.CurrentMutable.RegisterConstant<PreCheckBase>(TestPreCheck.FromRandomName(StatusSpinner.SpinnerState.Error));
|
||||
#endif
|
||||
|
||||
// need the interfaces for the controller and splat won't resolve them since we need to base classes in avalonia (what a mess), so doing it manually here
|
||||
|
@ -9,8 +9,8 @@
|
||||
<PackageIcon>icon.ico</PackageIcon>
|
||||
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
||||
<Configurations>Debug;Release;TEST</Configurations>
|
||||
<AssemblyVersion>2.9</AssemblyVersion>
|
||||
<FileVersion>2.9</FileVersion>
|
||||
<AssemblyVersion>2.10</AssemblyVersion>
|
||||
<FileVersion>2.10</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,7 +1,10 @@
|
||||
using Avalonia;
|
||||
using ReactiveUI;
|
||||
using Serilog;
|
||||
using SPTInstaller.CustomControls;
|
||||
using SPTInstaller.Helpers;
|
||||
using SPTInstaller.Interfaces;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SPTInstaller.ViewModels;
|
||||
@ -29,6 +32,20 @@ public class MessageViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _showCloseButton, value);
|
||||
}
|
||||
|
||||
private string _cacheInfoText;
|
||||
public string CacheInfoText
|
||||
{
|
||||
get => _cacheInfoText;
|
||||
set => this.RaiseAndSetIfChanged(ref _cacheInfoText, value);
|
||||
}
|
||||
|
||||
private StatusSpinner.SpinnerState _cacheCheckState;
|
||||
public StatusSpinner.SpinnerState CacheCheckState
|
||||
{
|
||||
get => _cacheCheckState;
|
||||
set => this.RaiseAndSetIfChanged(ref _cacheCheckState, value);
|
||||
}
|
||||
|
||||
public ICommand CloseCommand { get; set; } = ReactiveCommand.Create(() =>
|
||||
{
|
||||
if (Application.Current.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktopApp)
|
||||
@ -42,7 +59,16 @@ public class MessageViewModel : ViewModelBase
|
||||
ShowCloseButton = showCloseButton;
|
||||
Message = result.Message;
|
||||
|
||||
if(result.Succeeded)
|
||||
Task.Run(() =>
|
||||
{
|
||||
CacheInfoText = "Getting cache size ...";
|
||||
CacheCheckState = StatusSpinner.SpinnerState.Running;
|
||||
|
||||
CacheInfoText = $"Cache Size: {DownloadCacheHelper.GetCacheSizeText()}";
|
||||
CacheCheckState = StatusSpinner.SpinnerState.OK;
|
||||
});
|
||||
|
||||
if (result.Succeeded)
|
||||
{
|
||||
Log.Information(Message);
|
||||
return;
|
||||
|
@ -7,6 +7,7 @@ using DialogHostAvalonia;
|
||||
using ReactiveUI;
|
||||
using Serilog;
|
||||
using SPTInstaller.Controllers;
|
||||
using SPTInstaller.CustomControls;
|
||||
using SPTInstaller.CustomControls.Dialogs;
|
||||
using SPTInstaller.Helpers;
|
||||
using SPTInstaller.Models;
|
||||
@ -15,7 +16,6 @@ namespace SPTInstaller.ViewModels;
|
||||
|
||||
public class PreChecksViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
public ObservableCollection<PreCheckBase> PreChecks { get; set; } = new(ServiceHelper.GetAll<PreCheckBase>());
|
||||
public ICommand StartInstallCommand { get; set; }
|
||||
public ICommand ShowDetailedViewCommand { get; set; }
|
||||
@ -47,6 +47,20 @@ public class PreChecksViewModel : ViewModelBase
|
||||
set => this.RaiseAndSetIfChanged(ref _allowDetailsButton, value);
|
||||
}
|
||||
|
||||
private string _cacheInfoText;
|
||||
public string CacheInfoText
|
||||
{
|
||||
get => _cacheInfoText;
|
||||
set => this.RaiseAndSetIfChanged(ref _cacheInfoText, value);
|
||||
}
|
||||
|
||||
private StatusSpinner.SpinnerState _cacheCheckState;
|
||||
public StatusSpinner.SpinnerState CacheCheckState
|
||||
{
|
||||
get => _cacheCheckState;
|
||||
set => this.RaiseAndSetIfChanged(ref _cacheCheckState, value);
|
||||
}
|
||||
|
||||
public PreChecksViewModel(IScreen host) : base(host)
|
||||
{
|
||||
var data = ServiceHelper.Get<InternalData?>();
|
||||
@ -127,5 +141,14 @@ public class PreChecksViewModel : ViewModelBase
|
||||
AllowDetailsButton = true;
|
||||
AllowInstall = result.Succeeded;
|
||||
});
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
CacheInfoText = "Getting cache size ...";
|
||||
CacheCheckState = StatusSpinner.SpinnerState.Running;
|
||||
|
||||
CacheInfoText = $"Cache Size: {DownloadCacheHelper.GetCacheSizeText()}";
|
||||
CacheCheckState = StatusSpinner.SpinnerState.OK;
|
||||
});
|
||||
}
|
||||
}
|
@ -13,6 +13,10 @@
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
/>
|
||||
|
||||
<cc:CacheInfo Grid.Row="1" Grid.Column="2" HorizontalAlignment="Right" Padding="0 0 10 0"
|
||||
InfoText="{Binding CacheInfoText}" State="{Binding CacheCheckState}"
|
||||
/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3"
|
||||
Foreground="DodgerBlue" FontWeight="SemiBold" FontSize="16"
|
||||
@ -39,14 +43,12 @@
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<cc:DetailedPreCheckItem PreCheckName="{Binding Name}"
|
||||
IsRunning="{Binding IsRunning}"
|
||||
IsPending="{Binding IsPending}"
|
||||
IsRequired="{Binding IsRequired}"
|
||||
Passed="{Binding Passed}"
|
||||
PreCheckDetails="{Binding PreCheckDetails}"
|
||||
ActionButtonCommand="{Binding ActionButtonCommand}"
|
||||
ActionButtonText="{Binding ActionButtonText}"
|
||||
ActionButtonIsVisible="{Binding ActionButtonIsVisible}"
|
||||
State="{Binding State}"
|
||||
/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
|
@ -34,7 +34,7 @@
|
||||
MinButtonCommand="{Binding MinimizeCommand}"
|
||||
/>
|
||||
|
||||
<dialogHost:DialogHost Grid.Row="1" Background="Transparent">
|
||||
<dialogHost:DialogHost Grid.Row="1" Background="{StaticResource AKI_Background_Light}">
|
||||
<rxui:RoutedViewHost Router="{Binding Router}"/>
|
||||
</dialogHost:DialogHost>
|
||||
</Grid>
|
||||
|
@ -2,6 +2,7 @@
|
||||
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:cc="using:SPTInstaller.CustomControls"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="SPTInstaller.Views.MessageView"
|
||||
>
|
||||
@ -36,5 +37,10 @@
|
||||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
|
||||
Padding="20 10"
|
||||
/>
|
||||
|
||||
<cc:CacheInfo Grid.Row="4" Padding="10" Margin="10 0 0 0"
|
||||
VerticalAlignment="Bottom"
|
||||
InfoText="{Binding CacheInfoText}" State="{Binding CacheCheckState}"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
@ -26,7 +26,7 @@
|
||||
IsEnabled="{Binding AllowInstall}"
|
||||
Command="{Binding StartInstallCommand}"
|
||||
/>
|
||||
|
||||
|
||||
<ItemsControl ItemsSource="{Binding PreChecks}" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="4" HorizontalAlignment="Center">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
@ -36,14 +36,13 @@
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<cc:PreCheckItem PreCheckName="{Binding Name}"
|
||||
IsRunning="{Binding IsRunning}"
|
||||
IsPending="{Binding IsPending}"
|
||||
IsRequired="{Binding IsRequired}"
|
||||
Passed="{Binding Passed}"
|
||||
State="{Binding State}"
|
||||
/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<Button Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3" HorizontalAlignment="Center"
|
||||
Content="Detailed View"
|
||||
IsEnabled="{Binding AllowDetailsButton}"
|
||||
@ -61,5 +60,10 @@
|
||||
IndeterminateProgress="{Binding UpdateInfo.CheckingForUpdates}"
|
||||
UpdateAvailable="{Binding UpdateInfo.UpdateAvailable}"
|
||||
/>
|
||||
|
||||
<cc:CacheInfo Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="3" Padding="10"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Left"
|
||||
InfoText="{Binding CacheInfoText}" State="{Binding CacheCheckState}"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
Loading…
x
Reference in New Issue
Block a user