finish precheck details view

This commit is contained in:
IsWaffle 2023-07-29 14:26:45 -04:00
parent d269d674ad
commit b2a9e9942e
5 changed files with 93 additions and 21 deletions

View File

@ -5,7 +5,7 @@
>
<Design.PreviewWith>
<StackPanel Spacing="5" Background="{StaticResource AKI_Background_Dark}">
<Button Content="Blah"/>
<Button Content="Blah" Classes="outlinedTLCorner"/>
<TextBox Text="Some cool text here" Margin="5"/>
<TextBox Watermark="This is a watermark" Margin="5"/>
</StackPanel>
@ -64,6 +64,11 @@
<Setter Property="BorderThickness" Value="1"/>
</Style>
<!-- TextBlock Styles -->
<Style Selector="TextBlock">
<Setter Property="Foreground" Value="{StaticResource AKI_Foreground_Light}"/>
</Style>
<!-- Label Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Label.xaml -->
<Style Selector="Label">
@ -163,22 +168,22 @@
<Setter Property="BorderBrush" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
</Style>
<!-- Button Link Style -->
<Style Selector="Button.link">
<!-- Button outlined Style -->
<Style Selector="Button.outlinedTLCorner">
<Setter Property="Foreground" Value="{StaticResource AKI_Brush_Lighter}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
<Setter Property="BorderThickness" Value="2 2 0 0"/>
</Style>
<Style Selector="Button.link:pointerover /template/ ContentPresenter">
<Style Selector="Button.outlinedTLCorner: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"/>
<Setter Property="BorderBrush" Value="{StaticResource AKI_Brush_Yellow}"/>
<Setter Property="BorderThickness" Value="1 1 0 0"/>
</Style>
<Style Selector="Button.link:pressed /template/ ContentPresenter">
<Style Selector="Button.outlinedTLCorner:pressed /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>

View File

@ -26,7 +26,7 @@
</Style>
</UserControl.Styles>
<Grid RowDefinitions="3,AUTO,3,*,3" ColumnDefinitions="3,*,3" Margin="10">
<Grid RowDefinitions="3,AUTO,3,*,30,3" ColumnDefinitions="3,*,AUTO,3" Margin="10">
<Border Grid.RowSpan="5" Grid.ColumnSpan="3"
Background="{StaticResource AKI_Background_Light}" CornerRadius="8"
BoxShadow="3 3 10 .1 black"
@ -68,8 +68,16 @@
/>
</Grid>
<Label Grid.Row="3" Grid.Column="1"
Content="{Binding PreCheckDetails, RelativeSource={RelativeSource AncestorType=UserControl}}"
<TextBlock Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" TextWrapping="Wrap"
Margin="10"
Text="{Binding PreCheckDetails, RelativeSource={RelativeSource AncestorType=UserControl}}"
/>
<Button Grid.Row="4" Grid.Column="2"
CornerRadius="8 0 8 0" Classes="outlinedTLCorner"
Content="{Binding ActionButtonText, RelativeSource={RelativeSource AncestorType=UserControl}}"
Command="{Binding ActionButtonCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
IsVisible="{Binding ActionButtonIsVisible, RelativeSource={RelativeSource AncestorType=UserControl}}"
/>
</Grid>
</UserControl>

View File

@ -1,4 +1,5 @@
using Avalonia;
using System.Windows.Input;
namespace SPTInstaller.CustomControls;
public partial class DetailedPreCheckItem : PreCheckItem
@ -16,4 +17,32 @@ public partial class DetailedPreCheckItem : PreCheckItem
public static readonly StyledProperty<string> PreCheckDetailsProperty =
AvaloniaProperty.Register<DetailedPreCheckItem, string>(nameof(PreCheckDetails));
public bool ActionButtonIsVisible
{
get => GetValue(ActionButtonIsVisibleProperty);
set => SetValue(ActionButtonIsVisibleProperty, value);
}
public static readonly StyledProperty<bool> ActionButtonIsVisibleProperty =
AvaloniaProperty.Register<DetailedPreCheckItem, bool>(nameof(ActionButtonIsVisible));
public string ActionButtonText
{
get => GetValue(ActionButtonTextProperty);
set => SetValue(ActionButtonTextProperty, value);
}
public static readonly StyledProperty<string> ActionButtonTextProperty =
AvaloniaProperty.Register<DetailedPreCheckItem, string>(nameof(ActionButtonText));
public ICommand ActionButtonCommand
{
get => GetValue(ActionButtonCommandProperty);
set => SetValue(ActionButtonCommandProperty, value);
}
public static readonly StyledProperty<ICommand> ActionButtonCommandProperty =
AvaloniaProperty.Register<DetailedPreCheckItem, ICommand>(nameof(ActionButtonCommand));
}

View File

@ -2,6 +2,7 @@
using System.Threading.Tasks;
using System.Windows.Input;
using ReactiveUI;
using Serilog;
using SPTInstaller.Controllers;
using SPTInstaller.Helpers;
using SPTInstaller.Models;
@ -51,7 +52,11 @@ public class PreChecksViewModel : ViewModelBase
InstallPath = data.TargetInstallPath;
StartInstallCommand = ReactiveCommand.Create(() => NavigateTo(new InstallViewModel(HostScreen)));
ShowDetailedViewCommand = ReactiveCommand.Create(() => NavigateTo(new DetailedPreChecksViewModel(HostScreen)));
ShowDetailedViewCommand = ReactiveCommand.Create(() =>
{
Log.Logger.Information("Opening Detailed PreCheck View");
NavigateTo(new DetailedPreChecksViewModel(HostScreen));
});
Task.Run(async () =>
{

View File

@ -5,18 +5,35 @@
xmlns:cc="using:SPTInstaller.CustomControls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPTInstaller.Views.DetailedPreChecksView">
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,10">
<Label Grid.Row="1" HorizontalAlignment="Center"
Content="Placeholder for install location info because I'm lazy"
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,*,10" ColumnDefinitions="10,AUTO,*,AUTO,10">
<Label Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center"
Content="SPT will be installed into:"
FontSize="16"
FontWeight="SemiBold"
/>
<Separator Grid.Row="2" Margin="10 5" Height="2"/>
<TextBlock Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3"
Foreground="DodgerBlue" FontWeight="SemiBold" FontSize="16"
Text="{Binding InstallPath}" TextWrapping="Wrap"
Margin="5"
/>
<ScrollViewer Grid.Row="3">
<Button Grid.Row="1" Grid.RowSpan="3" Grid.Column="3"
Content="Start Install" Padding="20 10"
VerticalAlignment="Top"
FontSize="15" FontWeight="SemiBold"
Classes="yellow"
IsEnabled="{Binding AllowInstall}"
Command="{Binding StartInstallCommand}"
/>
<ScrollViewer Grid.Row="4" Grid.ColumnSpan="5">
<ItemsControl Items="{Binding PreChecks}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel HorizontalAlignment="Stretch" Spacing="10" Margin="10"/>
<StackPanel HorizontalAlignment="Stretch" Margin="10 0"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
@ -26,11 +43,19 @@
IsPending="{Binding IsPending}"
IsRequired="{Binding IsRequired}"
Passed="{Binding Passed}"
PreCheckDetails="Placeholder for details"
PreCheckDetails="{Binding PreCheckDetails}"
ActionButtonCommand="{Binding ActionButtonCommand}"
ActionButtonText="{Binding ActionButtonText}"
ActionButtonIsVisible="{Binding ActionButtonIsVisible}"
/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<Border Grid.Row="3" Grid.ColumnSpan="5"
BorderThickness="1" BorderBrush="Black" Height="2" Background="Black"
BoxShadow="0 3 10 2 black"
/>
</Grid>
</UserControl>