add cache info controls

This commit is contained in:
IsWaffle 2023-08-25 23:46:11 -04:00
parent ada70d7957
commit ce2cd80bf6
14 changed files with 239 additions and 9 deletions

View File

@ -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="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.Resources>
</Application> </Application>

View File

@ -5,7 +5,7 @@
> >
<Design.PreviewWith> <Design.PreviewWith>
<StackPanel Spacing="5" Background="{StaticResource AKI_Background_Dark}"> <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 Text="Some cool text here" Margin="5"/>
<TextBox Watermark="This is a watermark" Margin="5"/> <TextBox Watermark="This is a watermark" Margin="5"/>
</StackPanel> </StackPanel>
@ -190,6 +190,43 @@
<Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderThickness" Value="0"/>
</Style> </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 --> <!-- Button outlinedTLCorner Style -->
<Style Selector="Button.outlinedTLCorner"> <Style Selector="Button.outlinedTLCorner">
<Setter Property="Foreground" Value="{StaticResource AKI_Brush_Lighter}"/> <Setter Property="Foreground" Value="{StaticResource AKI_Brush_Lighter}"/>

View File

@ -1,8 +1,31 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 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" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPTInstaller.CustomControls.CacheInfo"> x:Class="SPTInstaller.CustomControls.CacheInfo">
Welcome to Avalonia! <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> </UserControl>

View File

@ -1,4 +1,8 @@
using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using DialogHostAvalonia;
using SPTInstaller.CustomControls.Dialogs;
using System.Threading.Tasks;
namespace SPTInstaller.CustomControls; namespace SPTInstaller.CustomControls;
public partial class CacheInfo : UserControl public partial class CacheInfo : UserControl
@ -7,4 +11,24 @@ public partial class CacheInfo : UserControl
{ {
InitializeComponent(); 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));
} }

View File

@ -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>

View File

@ -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"
});
}
}

View File

@ -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 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) private static bool CheckCache(FileInfo cacheFile, string expectedHash = null)
{ {
try try

View File

@ -9,8 +9,8 @@
<PackageIcon>icon.ico</PackageIcon> <PackageIcon>icon.ico</PackageIcon>
<ApplicationIcon>Assets\icon.ico</ApplicationIcon> <ApplicationIcon>Assets\icon.ico</ApplicationIcon>
<Configurations>Debug;Release;TEST</Configurations> <Configurations>Debug;Release;TEST</Configurations>
<AssemblyVersion>2.9</AssemblyVersion> <AssemblyVersion>2.10</AssemblyVersion>
<FileVersion>2.9</FileVersion> <FileVersion>2.10</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,7 +1,10 @@
using Avalonia; using Avalonia;
using ReactiveUI; using ReactiveUI;
using Serilog; using Serilog;
using SPTInstaller.CustomControls;
using SPTInstaller.Helpers;
using SPTInstaller.Interfaces; using SPTInstaller.Interfaces;
using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
namespace SPTInstaller.ViewModels; namespace SPTInstaller.ViewModels;
@ -29,6 +32,20 @@ public class MessageViewModel : ViewModelBase
set => this.RaiseAndSetIfChanged(ref _showCloseButton, value); 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(() => public ICommand CloseCommand { get; set; } = ReactiveCommand.Create(() =>
{ {
if (Application.Current.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktopApp) if (Application.Current.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktopApp)
@ -42,7 +59,16 @@ public class MessageViewModel : ViewModelBase
ShowCloseButton = showCloseButton; ShowCloseButton = showCloseButton;
Message = result.Message; 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); Log.Information(Message);
return; return;

View File

@ -7,6 +7,7 @@ using DialogHostAvalonia;
using ReactiveUI; using ReactiveUI;
using Serilog; using Serilog;
using SPTInstaller.Controllers; using SPTInstaller.Controllers;
using SPTInstaller.CustomControls;
using SPTInstaller.CustomControls.Dialogs; using SPTInstaller.CustomControls.Dialogs;
using SPTInstaller.Helpers; using SPTInstaller.Helpers;
using SPTInstaller.Models; using SPTInstaller.Models;
@ -15,7 +16,6 @@ namespace SPTInstaller.ViewModels;
public class PreChecksViewModel : ViewModelBase public class PreChecksViewModel : ViewModelBase
{ {
public ObservableCollection<PreCheckBase> PreChecks { get; set; } = new(ServiceHelper.GetAll<PreCheckBase>()); public ObservableCollection<PreCheckBase> PreChecks { get; set; } = new(ServiceHelper.GetAll<PreCheckBase>());
public ICommand StartInstallCommand { get; set; } public ICommand StartInstallCommand { get; set; }
public ICommand ShowDetailedViewCommand { get; set; } public ICommand ShowDetailedViewCommand { get; set; }
@ -47,6 +47,20 @@ public class PreChecksViewModel : ViewModelBase
set => this.RaiseAndSetIfChanged(ref _allowDetailsButton, value); 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) public PreChecksViewModel(IScreen host) : base(host)
{ {
var data = ServiceHelper.Get<InternalData?>(); var data = ServiceHelper.Get<InternalData?>();
@ -127,5 +141,14 @@ public class PreChecksViewModel : ViewModelBase
AllowDetailsButton = true; AllowDetailsButton = true;
AllowInstall = result.Succeeded; AllowInstall = result.Succeeded;
}); });
Task.Run(() =>
{
CacheInfoText = "Getting cache size ...";
CacheCheckState = StatusSpinner.SpinnerState.Running;
CacheInfoText = $"Cache Size: {DownloadCacheHelper.GetCacheSizeText()}";
CacheCheckState = StatusSpinner.SpinnerState.OK;
});
} }
} }

View File

@ -14,6 +14,10 @@
FontWeight="SemiBold" 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" <TextBlock Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3"
Foreground="DodgerBlue" FontWeight="SemiBold" FontSize="16" Foreground="DodgerBlue" FontWeight="SemiBold" FontSize="16"
Text="{Binding InstallPath}" TextWrapping="Wrap" Text="{Binding InstallPath}" TextWrapping="Wrap"

View File

@ -34,7 +34,7 @@
MinButtonCommand="{Binding MinimizeCommand}" 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}"/> <rxui:RoutedViewHost Router="{Binding Router}"/>
</dialogHost:DialogHost> </dialogHost:DialogHost>
</Grid> </Grid>

View File

@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:cc="using:SPTInstaller.CustomControls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPTInstaller.Views.MessageView" x:Class="SPTInstaller.Views.MessageView"
> >
@ -36,5 +37,10 @@
VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
Padding="20 10" Padding="20 10"
/> />
<cc:CacheInfo Grid.Row="4" Padding="10" Margin="10 0 0 0"
VerticalAlignment="Bottom"
InfoText="{Binding CacheInfoText}" State="{Binding CacheCheckState}"
/>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -60,5 +60,10 @@
IndeterminateProgress="{Binding UpdateInfo.CheckingForUpdates}" IndeterminateProgress="{Binding UpdateInfo.CheckingForUpdates}"
UpdateAvailable="{Binding UpdateInfo.UpdateAvailable}" 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> </Grid>
</UserControl> </UserControl>