mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Error triangle under play button
This commit is contained in:
parent
33279a5522
commit
1bd8894a1f
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using DynamicData.Kernel;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
@ -86,6 +87,15 @@ namespace Wabbajack
|
||||
if (err == null) return Create(nullIsSuccess);
|
||||
return new ErrorResponse(err.Succeeded, err.Reason, err.Exception);
|
||||
}
|
||||
|
||||
public static ErrorResponse FirstFail(params ErrorResponse[] responses)
|
||||
{
|
||||
foreach (var resp in responses)
|
||||
{
|
||||
if (resp.Failed) return resp;
|
||||
}
|
||||
return ErrorResponse.Success;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IErrorResponse
|
||||
|
@ -17,7 +17,7 @@ namespace Wabbajack
|
||||
bool SupportsAfterInstallNavigation { get; }
|
||||
void AfterInstallNavigation();
|
||||
int ConfigVisualVerticalOffset { get; }
|
||||
IObservable<bool> CanInstall { get; }
|
||||
ErrorResponse CanInstall { get; }
|
||||
Task<bool> Install();
|
||||
IUserIntervention InterventionConverter(IUserIntervention intervention);
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ namespace Wabbajack
|
||||
|
||||
BeginCommand = ReactiveCommand.CreateFromTask(
|
||||
canExecute: this.WhenAny(x => x.Installer.CanInstall)
|
||||
.Switch(),
|
||||
.Select(err => err.Succeeded),
|
||||
execute: async () =>
|
||||
{
|
||||
try
|
||||
|
@ -20,7 +20,8 @@ namespace Wabbajack
|
||||
{
|
||||
public InstallerVM Parent { get; }
|
||||
|
||||
public IObservable<bool> CanInstall { get; }
|
||||
private readonly ObservableAsPropertyHelper<ErrorResponse> _CanInstall;
|
||||
public ErrorResponse CanInstall => _CanInstall.Value;
|
||||
|
||||
[Reactive]
|
||||
public AInstaller ActiveInstallation { get; private set; }
|
||||
@ -65,14 +66,15 @@ namespace Wabbajack
|
||||
.Select(i => MO2Installer.CheckValidInstallPath(i.target, i.download))
|
||||
.ObserveOnGuiThread();
|
||||
|
||||
CanInstall = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.Location.InError),
|
||||
this.WhenAny(x => x.DownloadLocation.InError),
|
||||
installerVM.WhenAny(x => x.ModListLocation.InError),
|
||||
resultSelector: (loc, modlist, download) =>
|
||||
{
|
||||
return !loc && !download && !modlist;
|
||||
});
|
||||
_CanInstall = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.Location.ErrorState),
|
||||
this.WhenAny(x => x.DownloadLocation.ErrorState),
|
||||
installerVM.WhenAny(x => x.ModListLocation.ErrorState),
|
||||
resultSelector: (loc, modlist, download) =>
|
||||
{
|
||||
return ErrorResponse.FirstFail(loc, modlist, download);
|
||||
})
|
||||
.ToProperty(this, nameof(CanInstall));
|
||||
|
||||
// Have Installation location updates modify the downloads location if empty
|
||||
this.WhenAny(x => x.Location.TargetPath)
|
||||
|
@ -64,7 +64,12 @@ namespace Wabbajack
|
||||
.BindToStrict(this, x => x.CpuListControl.ItemsSource)
|
||||
.DisposeWith(disposable);
|
||||
|
||||
this.Bind(this.ViewModel, x => x.MWVM.Settings.Performance.TargetUsage, x => x.TargetPercentageSlider.Value)
|
||||
this.BindStrict(
|
||||
this.ViewModel,
|
||||
x => x.MWVM.Settings.Performance.TargetUsage,
|
||||
x => x.TargetPercentageSlider.Value,
|
||||
vmToViewConverter: p => p.Value,
|
||||
viewToVmConverter: d => new Percent(d))
|
||||
.DisposeWith(disposable);
|
||||
|
||||
this.WhenAny(x => x.ViewModel.MWVM.Settings.Performance.TargetUsage)
|
||||
|
@ -0,0 +1,99 @@
|
||||
<rxui:ReactiveUserControl
|
||||
x:Class="Wabbajack.InstallationConfigurationView"
|
||||
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: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">
|
||||
<Grid Background="{StaticResource WindowBackgroundBrush}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0"
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="5" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="120" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle x:Name="InstallConfigSpacer" Grid.Row="0" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="Target Modlist"
|
||||
TextAlignment="Center" />
|
||||
<local:FilePicker Grid.Row="1" Grid.Column="2"
|
||||
x:Name="ModListLocationPicker"
|
||||
Height="30"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14" />
|
||||
<ContentPresenter Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3"
|
||||
x:Name="InstallerCustomizationContent"
|
||||
VerticalAlignment="Top">
|
||||
<ContentPresenter.Resources>
|
||||
<DataTemplate DataType="{x:Type local:MO2InstallerVM}">
|
||||
<local:MO2InstallerConfigView />
|
||||
</DataTemplate>
|
||||
</ContentPresenter.Resources>
|
||||
<ContentPresenter.Style>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content}" Value="{x:Null}">
|
||||
<Setter Property="ContentPresenter.ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Rectangle Height="74" />
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentPresenter.Style>
|
||||
</ContentPresenter>
|
||||
</Grid>
|
||||
<Grid Grid.Column="2" Margin="0,0,25,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<local:BeginButton Grid.Row="1"
|
||||
x:Name="BeginButton"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" />
|
||||
<icon:PackIconFontAwesome Grid.Row="2"
|
||||
x:Name="ErrorSummaryIconGlow"
|
||||
HorizontalAlignment="Center"
|
||||
Foreground="{StaticResource WarningBrush}"
|
||||
Kind="ExclamationTriangleSolid"
|
||||
Opacity="0.6">
|
||||
<icon:PackIconFontAwesome.Effect>
|
||||
<BlurEffect Radius="15" />
|
||||
</icon:PackIconFontAwesome.Effect>
|
||||
</icon:PackIconFontAwesome>
|
||||
<icon:PackIconFontAwesome Grid.Row="2"
|
||||
x:Name="ErrorSummaryIcon"
|
||||
HorizontalAlignment="Center"
|
||||
Foreground="{StaticResource WarningBrush}"
|
||||
Kind="ExclamationTriangleSolid" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</rxui:ReactiveUserControl>
|
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
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 InstallationConfigurationView.xaml
|
||||
/// </summary>
|
||||
public partial class InstallationConfigurationView : ReactiveUserControl<InstallerVM>
|
||||
{
|
||||
public InstallationConfigurationView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.WhenActivated(dispose =>
|
||||
{
|
||||
this.WhenAny(x => x.ViewModel.Installer.ConfigVisualVerticalOffset)
|
||||
.Select(i => (double)i)
|
||||
.BindToStrict(this, x => x.InstallConfigSpacer.Height)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.ModListLocation)
|
||||
.BindToStrict(this, x => x.ModListLocationPicker.PickerVM)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.Installer)
|
||||
.BindToStrict(this, x => x.InstallerCustomizationContent.Content)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.BeginCommand)
|
||||
.BindToStrict(this, x => x.BeginButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
|
||||
// Error icon display
|
||||
var vis = this.WhenAny(x => x.ViewModel.Installer.CanInstall)
|
||||
.Select(err => err.Failed ? Visibility.Visible : Visibility.Hidden)
|
||||
.Replay(1)
|
||||
.RefCount();
|
||||
vis.BindToStrict(this, x => x.ErrorSummaryIconGlow.Visibility)
|
||||
.DisposeWith(dispose);
|
||||
vis.BindToStrict(this, x => x.ErrorSummaryIcon.Visibility)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.Installer.CanInstall)
|
||||
.Select(x => x.Reason)
|
||||
.BindToStrict(this, x => x.ErrorSummaryIcon.ToolTip)
|
||||
.DisposeWith(dispose);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -284,72 +284,9 @@
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid Grid.Column="2"
|
||||
<local:InstallationConfigurationView Grid.Column="2"
|
||||
x:Name="InstallationConfigurationView"
|
||||
Background="{StaticResource WindowBackgroundBrush}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0"
|
||||
Margin="5"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="5" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="120" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle x:Name="InstallConfigSpacer" Grid.Row="0" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="Target Modlist"
|
||||
TextAlignment="Center" />
|
||||
<local:FilePicker Grid.Row="1" Grid.Column="2"
|
||||
x:Name="ModListLocationPicker"
|
||||
Height="30"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14" />
|
||||
<ContentPresenter Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3"
|
||||
x:Name="InstallerCustomizationContent"
|
||||
VerticalAlignment="Top">
|
||||
<ContentPresenter.Resources>
|
||||
<DataTemplate DataType="{x:Type local:MO2InstallerVM}">
|
||||
<local:MO2InstallerConfigView />
|
||||
</DataTemplate>
|
||||
</ContentPresenter.Resources>
|
||||
<ContentPresenter.Style>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content}" Value="{x:Null}">
|
||||
<Setter Property="ContentPresenter.ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Rectangle Height="74" />
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContentPresenter.Style>
|
||||
</ContentPresenter>
|
||||
</Grid>
|
||||
<local:BeginButton Grid.Column="2"
|
||||
x:Name="BeginButton"
|
||||
Margin="0,0,25,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
ViewModel="{Binding}" />
|
||||
</Grid>
|
||||
<Grid Grid.Row="2"
|
||||
x:Name="MidInstallDisplayGrid"
|
||||
|
@ -110,19 +110,6 @@ namespace Wabbajack
|
||||
.Select(started => started ? Visibility.Collapsed : Visibility.Visible)
|
||||
.BindToStrict(this, x => x.InstallationConfigurationView.Visibility)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.Installer.ConfigVisualVerticalOffset)
|
||||
.Select(i => (double)i)
|
||||
.BindToStrict(this, x => x.InstallConfigSpacer.Height)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.ModListLocation)
|
||||
.BindToStrict(this, x => x.ModListLocationPicker.PickerVM)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.Installer)
|
||||
.BindToStrict(this, x => x.InstallerCustomizationContent.Content)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.BeginCommand)
|
||||
.BindToStrict(this, x => x.BeginButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
|
||||
// Bottom mid-install display
|
||||
this.WhenAny(x => x.ViewModel.StartedInstallation)
|
||||
|
Loading…
Reference in New Issue
Block a user