CompilationCompleteView swapped to RxUserControl

This commit is contained in:
Justin Swanson 2020-01-20 16:26:45 -06:00
parent 7ad46c65cc
commit 86391512bc
3 changed files with 42 additions and 20 deletions

View File

@ -1,4 +1,4 @@
<UserControl
<rxui:ReactiveUserControl
x:Class="Wabbajack.CompilationCompleteView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -6,10 +6,12 @@
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:Wabbajack"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:rxui="http://reactiveui.net"
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="local:CompilerVM"
mc:Ignorable="d">
<local:AttentionBorder ClipToBounds="True" Failure="{Binding Completed.Failed}">
<local:AttentionBorder x:Name="AttentionBorder" ClipToBounds="True">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
@ -21,6 +23,7 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="TitleText"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="3"
@ -32,16 +35,6 @@
<TextBlock.Effect>
<DropShadowEffect BlurRadius="25" Opacity="0.5" />
</TextBlock.Effect>
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="Compilation Complete" />
<Style.Triggers>
<DataTrigger Binding="{Binding Completed.Failed}" Value="True">
<Setter Property="Text" Value="Compilation Failed" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Grid
Grid.Row="1"
@ -52,10 +45,10 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button
x:Name="BackButton"
Grid.Row="0"
Width="55"
Height="55"
Command="{Binding BackCommand}"
Style="{StaticResource CircleButtonStyle}">
<icon:PackIconMaterial
Width="28"
@ -72,16 +65,15 @@
<Grid
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Center"
Visibility="{Binding CompilerSupportsAfterCompileNavigation, Converter={StaticResource bool2VisibilityConverter}}">
VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button
x:Name="GoToModlistButton"
Width="55"
Height="55"
Command="{Binding GoToModlistCommand}"
Style="{StaticResource CircleButtonStyle}">
<icon:PackIconMaterial
Width="25"
@ -127,9 +119,9 @@
</Button.Effect>
</Button>-->
<Button
x:Name="CloseWhenCompletedButton"
Width="55"
Height="55"
Command="{Binding CloseWhenCompleteCommand}"
Style="{StaticResource CircleButtonStyle}">
<icon:PackIconMaterial
Width="30"
@ -145,4 +137,4 @@
</Grid>
</Grid>
</local:AttentionBorder>
</UserControl>
</rxui:ReactiveUserControl>

View File

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@ -12,17 +14,42 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ReactiveUI;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for CompilationCompleteView.xaml
/// </summary>
public partial class CompilationCompleteView : UserControl
public partial class CompilationCompleteView : ReactiveUserControl<CompilerVM>
{
public CompilationCompleteView()
{
InitializeComponent();
this.WhenActivated(dispose =>
{
this.WhenAny(x => x.ViewModel.Completed)
.Select(x => x?.Failed ?? false)
.BindToStrict(this, x => x.AttentionBorder.Failure)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.Completed)
.Select(x => x?.Failed ?? false)
.Select(failed =>
{
return $"Compilation {(failed ? "Failed" : "Complete")}";
})
.BindToStrict(this, x => x.TitleText.Text)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.BackCommand)
.BindToStrict(this, x => x.BackButton.Command)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.GoToModlistCommand)
.BindToStrict(this, x => x.GoToModlistButton.Command)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.CloseWhenCompleteCommand)
.BindToStrict(this, x => x.CloseWhenCompletedButton.Command)
.DisposeWith(dispose);
});
}
}
}

View File

@ -305,7 +305,10 @@
<local:ConfirmationInterventionView DataContext="{Binding ActiveGlobalUserIntervention}" Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsTypeVisibilityConverter}, ConverterParameter={x:Type common:ConfirmationIntervention}}" />
</Grid>
</local:AttentionBorder>
<local:CompilationCompleteView x:Name="CompilationComplete" Grid.Column="2" />
<local:CompilationCompleteView
x:Name="CompilationComplete"
Grid.Column="2"
ViewModel="{Binding}" />
</Grid>
</Grid>
</rxui:ReactiveUserControl>