mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
InstallationCompleteView swapped to RxUserControl
This commit is contained in:
parent
86391512bc
commit
95260b1342
Wabbajack
View Models/Installers
Views/Installers
@ -96,13 +96,13 @@ namespace Wabbajack
|
||||
public bool IsActive => _IsActive.Value;
|
||||
|
||||
// Command properties
|
||||
public IReactiveCommand ShowReportCommand { get; }
|
||||
public IReactiveCommand OpenReadmeCommand { get; }
|
||||
public IReactiveCommand VisitWebsiteCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ShowReportCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> OpenReadmeCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> VisitWebsiteCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> BackCommand { get; }
|
||||
public IReactiveCommand CloseWhenCompleteCommand { get; }
|
||||
public IReactiveCommand GoToInstallCommand { get; }
|
||||
public IReactiveCommand BeginCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> CloseWhenCompleteCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> GoToInstallCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> BeginCommand { get; }
|
||||
|
||||
public InstallerVM(MainWindowVM mainWindowVM)
|
||||
{
|
||||
@ -324,7 +324,11 @@ namespace Wabbajack
|
||||
.Select(modList => !string.IsNullOrEmpty(modList?.Readme))
|
||||
.ObserveOnGuiThread());
|
||||
VisitWebsiteCommand = ReactiveCommand.Create(
|
||||
execute: () => Process.Start(ModList.Website),
|
||||
execute: () =>
|
||||
{
|
||||
Process.Start(ModList.Website);
|
||||
return Unit.Default;
|
||||
},
|
||||
canExecute: this.WhenAny(x => x.ModList.Website)
|
||||
.Select(x => x?.StartsWith("https://") ?? false)
|
||||
.ObserveOnGuiThread());
|
||||
|
@ -1,4 +1,4 @@
|
||||
<UserControl
|
||||
<rxui:ReactiveUserControl
|
||||
x:Class="Wabbajack.InstallationCompleteView"
|
||||
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:InstallerVM"
|
||||
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="*" />
|
||||
@ -22,6 +24,7 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
x:Name="TitleText"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
@ -33,16 +36,6 @@
|
||||
<TextBlock.Effect>
|
||||
<DropShadowEffect BlurRadius="25" Opacity="0.5" />
|
||||
</TextBlock.Effect>
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Text" Value="Installation Complete" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Completed.Failed}" Value="True">
|
||||
<Setter Property="Text" Value="Installation Failed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
@ -53,10 +46,10 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Button
|
||||
x:Name="BackButton"
|
||||
Grid.Row="0"
|
||||
Width="50"
|
||||
Height="50"
|
||||
Command="{Binding BackCommand}"
|
||||
Style="{StaticResource CircleButtonStyle}">
|
||||
<icon:PackIconMaterial
|
||||
Width="25"
|
||||
@ -80,9 +73,9 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Button
|
||||
x:Name="GoToInstallButton"
|
||||
Width="50"
|
||||
Height="50"
|
||||
Command="{Binding GoToInstallCommand}"
|
||||
Style="{StaticResource CircleButtonStyle}">
|
||||
<icon:PackIconMaterial
|
||||
Width="23"
|
||||
@ -106,9 +99,9 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Button
|
||||
x:Name="OpenReadmeButton"
|
||||
Width="50"
|
||||
Height="50"
|
||||
Command="{Binding OpenReadmeCommand}"
|
||||
Style="{StaticResource CircleButtonStyle}">
|
||||
<icon:PackIconFontAwesome
|
||||
Width="25"
|
||||
@ -132,9 +125,9 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Button
|
||||
x:Name="CloseButton"
|
||||
Width="50"
|
||||
Height="50"
|
||||
Command="{Binding CloseWhenCompleteCommand}"
|
||||
Style="{StaticResource CircleButtonStyle}">
|
||||
<icon:PackIconMaterial
|
||||
Width="25"
|
||||
@ -150,4 +143,4 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
</local:AttentionBorder>
|
||||
</UserControl>
|
||||
</rxui:ReactiveUserControl>
|
||||
|
@ -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,45 @@ 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 InstallationCompleteView.xaml
|
||||
/// </summary>
|
||||
public partial class InstallationCompleteView : UserControl
|
||||
public partial class InstallationCompleteView : ReactiveUserControl<InstallerVM>
|
||||
{
|
||||
public InstallationCompleteView()
|
||||
{
|
||||
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 $"Installation {(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.GoToInstallCommand)
|
||||
.BindToStrict(this, x => x.GoToInstallButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.OpenReadmeCommand)
|
||||
.BindToStrict(this, x => x.OpenReadmeButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.CloseWhenCompleteCommand)
|
||||
.BindToStrict(this, x => x.CloseButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -435,7 +435,10 @@
|
||||
<local:ConfirmUpdateOfExistingInstallView Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsTypeVisibilityConverter}, ConverterParameter={x:Type lib:ConfirmUpdateOfExistingInstall}}" />
|
||||
</Grid>
|
||||
</local:AttentionBorder>
|
||||
<local:InstallationCompleteView Grid.Column="2" Visibility="{Binding Completed, Converter={StaticResource IsNotNullVisibilityConverter}, FallbackValue=Collapsed}" />
|
||||
<local:InstallationCompleteView
|
||||
Grid.Column="2"
|
||||
ViewModel="{Binding}"
|
||||
Visibility="{Binding Completed, Converter={StaticResource IsNotNullVisibilityConverter}, FallbackValue=Collapsed}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
Loading…
Reference in New Issue
Block a user