Compiler/Installer back buttons

This commit is contained in:
Justin Swanson 2019-11-24 17:42:28 -06:00
parent d1fec7feec
commit da75aca5ca
6 changed files with 54 additions and 4 deletions

View File

@ -102,7 +102,7 @@
<SolidColorBrush x:Key="PressedButtonBackground" Color="{StaticResource PressedBackgroundColor}" />
<SolidColorBrush x:Key="MouseOverButtonBackground" Color="{StaticResource LightBackgroundColor}" />
<SolidColorBrush x:Key="DisabledButtonBackground" Color="{StaticResource LightDisabledBackgroundColor}" />
<SolidColorBrush x:Key="DisabledButtonForeground" Color="{StaticResource DisabledBackgroundColor}" />
<SolidColorBrush x:Key="DisabledButtonForeground" Color="#FF7E7E7E" />
<SolidColorBrush x:Key="Expander.Background" Color="{StaticResource LightBackgroundColor}" />
<SolidColorBrush x:Key="Expander.MouseOver.Arrow.Stroke" Color="{StaticResource ForegroundColor}" />
@ -1462,6 +1462,11 @@
BasedOn="{StaticResource MahApps.Metro.Styles.MetroCircleButtonStyle}"
TargetType="ButtonBase">
<Setter Property="Focusable" Value="False" />
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{StaticResource DisabledButtonForeground}" />
</Trigger>
</Style.Triggers>
</Style>
<!-- ToggleButton -->

View File

@ -40,6 +40,8 @@ namespace Wabbajack
public ObservableCollectionExtended<CPUStatus> StatusList { get; } = new ObservableCollectionExtended<CPUStatus>();
public ObservableCollectionExtended<string> Log => MWVM.Log;
public IReactiveCommand BackCommand { get; }
public CompilerVM(MainWindowVM mainWindowVM)
{
MWVM = mainWindowVM;
@ -107,6 +109,11 @@ namespace Wabbajack
.ObserveOnGuiThread()
.ToProperty(this, nameof(Compiling));
BackCommand = ReactiveCommand.Create(
execute: () => mainWindowVM.ActivePane = mainWindowVM.ModeSelectionVM,
canExecute: this.WhenAny(x => x.Compiling)
.Select(x => !x));
// Compile progress updates and populate ObservableCollection
this.WhenAny(x => x.Compiler.ActiveCompilation)
.SelectMany(c => c?.QueueStatus ?? Observable.Empty<CPUStatus>())

View File

@ -87,6 +87,7 @@ namespace Wabbajack
public IReactiveCommand ShowReportCommand { get; }
public IReactiveCommand OpenReadmeCommand { get; }
public IReactiveCommand VisitWebsiteCommand { get; }
public IReactiveCommand BackCommand { get; }
public InstallerVM(MainWindowVM mainWindowVM)
{
@ -164,6 +165,11 @@ namespace Wabbajack
.ObserveOnGuiThread()
.ToProperty(this, nameof(Installing));
BackCommand = ReactiveCommand.Create(
execute: () => mainWindowVM.ActivePane = mainWindowVM.ModeSelectionVM,
canExecute: this.WhenAny(x => x.Installing)
.Select(x => !x));
_percentCompleted = this.WhenAny(x => x.ActiveInstallation)
.StartWith(default(AInstaller))
.Pairwise()

View File

@ -87,9 +87,9 @@
Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
<TextBlock
Grid.Column="0"
Width="90"
Margin="10,0,0,8"
VerticalAlignment="Bottom"
Width="130"
Margin="0,0,0,0"
VerticalAlignment="Center"
FontFamily="Lucida Sans"
FontWeight="Black"
Text="{Binding StatePrefixTitle, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"

View File

@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:Wabbajack"
xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@ -58,6 +59,22 @@
OverhangShadow="True"
ProgressPercent="{Binding PercentCompleted}"
StatePrefixTitle="Compiling" />
<Button
x:Name="BackButton"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="5"
Width="30"
Height="30"
Margin="12,5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="{StaticResource ButtonBackground}"
Command="{Binding BackCommand}"
Style="{StaticResource CircleButtonStyle}"
ToolTip="Back to main menu">
<icon:PackIconMaterial Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" Kind="ArrowLeft" />
</Button>
<ScrollViewer
Grid.Row="1"
Grid.Column="1"

View File

@ -216,6 +216,21 @@
Kind="TimesCircleSolid" />
</Button>-->
</local:TopProgressView>
<Button
x:Name="BackButton"
Grid.Row="0"
Grid.RowSpan="2"
Width="30"
Height="30"
Margin="7,5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="{StaticResource ButtonBackground}"
Command="{Binding BackCommand}"
Style="{StaticResource CircleButtonStyle}"
ToolTip="Back to main menu">
<icon:PackIconMaterial Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" Kind="ArrowLeft" />
</Button>
<!-- Bottom Area -->
<Grid
Grid.Row="2"