Add boilerplate for starting on compiler file manager

This commit is contained in:
trawzified 2024-05-21 23:10:37 +02:00
parent 2c2ce89698
commit 9af6e8a4c8
27 changed files with 297 additions and 260 deletions

View File

@ -168,8 +168,9 @@ namespace Wabbajack
services.AddTransient<HomeVM>();
services.AddTransient<ModListGalleryVM>();
services.AddTransient<CompilerDetailsVM>();
services.AddTransient<CompilerHomeVM>();
services.AddTransient<CompilerDetailsVM>();
services.AddTransient<CompilerFileManagerVM>();
services.AddTransient<InstallerVM>();
services.AddTransient<SettingsVM>();
services.AddTransient<WebBrowserVM>();

View File

@ -6,17 +6,16 @@ using Wabbajack.Paths;
namespace Wabbajack.Messages;
public class LoadModlistForCompiling
public class LoadCompilerSettings
{
public CompilerSettings CompilerSettings { get; set; }
public LoadModlistForCompiling(CompilerSettings cs)
public LoadCompilerSettings(CompilerSettings cs)
{
CompilerSettings = cs;
}
public static void Send(CompilerSettings cs)
{
MessageBus.Current.SendMessage(new LoadModlistForCompiling(cs));
MessageBus.Current.SendMessage(new LoadCompilerSettings(cs));
}
}

View File

@ -8,8 +8,9 @@ public enum ScreenType
ModListGallery,
Installer,
Settings,
CompilerDetails,
CompilerHome,
CompilerDetails,
CompilerFileManager,
ModListContents,
WebBrowser
}

View File

@ -1141,7 +1141,7 @@
</Setter>
</Style>
<Style x:Key="MainButtonStyle" TargetType="{x:Type Button}">
<Style x:Key="MainButtonBaseStyle" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
<Setter Property="Background" Value="{StaticResource DarkBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource ButtonBorder}" />
@ -1151,6 +1151,36 @@
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="1" />
<Style.Resources>
<Style TargetType="ic:SymbolIcon">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=IsMouseOver}" Value="True">
<Setter Property="IsFilled" Value="True"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Style.Resources>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{StaticResource DarkHoverBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource MahApps.Brushes.Transparent}" />
<Setter Property="Foreground" Value="{StaticResource PrimaryBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="{StaticResource PressedButtonBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource MahApps.Brushes.Transparent}" />
<Setter Property="Foreground" Value="{StaticResource PrimaryBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{StaticResource DisabledButtonForeground}" />
<Setter Property="Background" Value="{StaticResource DisabledButtonBackground}" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="MainButtonStyle" BasedOn="{StaticResource MainButtonBaseStyle}" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
@ -1187,23 +1217,8 @@
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Resources>
<Style TargetType="ic:SymbolIcon">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=IsMouseOver}" Value="True">
<Setter Property="IsFilled" Value="True"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Style.Resources>
</Style>
<Style x:Key="LargeButtonStyle" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
<Setter Property="Background" Value="{StaticResource DarkBackgroundBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource ButtonBorder}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Foreground" Value="{StaticResource ButtonForeground}" />
<Style x:Key="LargeButtonStyle" BasedOn="{StaticResource MainButtonStyle}" TargetType="{x:Type Button}">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Padding" Value="2" />
@ -1244,15 +1259,6 @@
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Resources>
<Style TargetType="ic:SymbolIcon">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Button, AncestorLevel=1}, Path=IsMouseOver}" Value="True">
<Setter Property="IsFilled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</Style.Resources>
</Style>
<Style x:Key="MainNavButtonStyle" BasedOn="{StaticResource MainButtonStyle}" TargetType="{x:Type Button}">
<Setter Property="Background" Value="{StaticResource WindowBackgroundBrush}"/>
@ -1388,6 +1394,39 @@
</Style.Triggers>
</Style>
<Style x:Key="AltButtonStyle" BasedOn="{StaticResource MainButtonStyle}" TargetType="{x:Type Button}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="{StaticResource PrimaryBrush}"/>
<Setter Property="Foreground" Value="{StaticResource BackgroundBrush}"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<Style x:Key="WizardButtonStyle" BasedOn="{StaticResource AltButtonStyle}" TargetType="{x:Type Button}">
<Setter Property="Width" Value="200" />
<Setter Property="Margin" Value="0, 8, 0, 0" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4" >
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ToggleButton -->
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />

View File

@ -27,7 +27,7 @@ namespace Wabbajack
{
_logger.LogInformation($"Selected modlist {CompilerSettings.ModListName} for compilation, located in '{CompilerSettings.Source}'");
NavigateToGlobal.Send(ScreenType.CompilerDetails);
LoadModlistForCompiling.Send(CompilerSettings);
LoadCompilerSettings.Send(CompilerSettings);
}
}
}

View File

@ -66,8 +66,9 @@ namespace Wabbajack
public FilePickerVM ModListImageLocation { get; } = new();
public ReactiveCommand<Unit, Unit> ExecuteCommand { get; }
/* public ReactiveCommand<Unit, Unit> ExecuteCommand { get; } */
public ReactiveCommand<Unit, Unit> ReInferSettingsCommand { get; set; }
public ReactiveCommand<Unit, Unit> NextCommand { get; }
public LogStream LoggerProvider { get; }
public ReadOnlyObservableCollection<CPUDisplayVM> StatusList => _resourceMonitor.Tasks;
@ -88,7 +89,7 @@ namespace Wabbajack
_inferencer = inferencer;
_wjClient = wjClient;
MessageBus.Current.Listen<LoadModlistForCompiling>()
MessageBus.Current.Listen<LoadCompilerSettings>()
.Subscribe(msg => {
var csVm = new CompilerSettingsVM(msg.CompilerSettings);
ModlistLocation.TargetPath = csVm.ProfilePath;
@ -110,7 +111,7 @@ namespace Wabbajack
SubCompilerVM = new MO2CompilerVM(this);
ExecuteCommand = ReactiveCommand.CreateFromTask(async () => await StartCompilation());
//ExecuteCommand = ReactiveCommand.CreateFromTask(async () => await StartCompilation());
/*ReInferSettingsCommand = ReactiveCommand.CreateFromTask(async () => await ReInferSettings(),
this.WhenAnyValue(vm => vm.Settings.Source)
@ -121,6 +122,7 @@ namespace Wabbajack
.Select(p => !string.IsNullOrWhiteSpace(p)))
.Select(v => v.First && v.Second));
*/
NextCommand = ReactiveCommand.CreateFromTask(async () => await NextPage());
ModlistLocation = new FilePickerVM
{
@ -260,6 +262,12 @@ namespace Wabbajack
return settings;
}
private async Task NextPage()
{
NavigateToGlobal.Send(ScreenType.CompilerFileManager);
LoadCompilerSettings.Send(Settings.ToCompilerSettings());
}
private async Task StartCompilation()
{
var tsk = Task.Run(async () =>

View File

@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reactive;
using Microsoft.Extensions.Logging;
using Wabbajack.Messages;
using ReactiveUI;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;
using DynamicData;
using Microsoft.WindowsAPICodePack.Dialogs;
using ReactiveUI.Fody.Helpers;
using Wabbajack.Common;
using Wabbajack.Compiler;
using Wabbajack.DTOs;
using Wabbajack.DTOs.JsonConverters;
using Wabbajack.Extensions;
using Wabbajack.Installer;
using Wabbajack.Models;
using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
using Wabbajack.RateLimiter;
using Wabbajack.Services.OSIntegrated;
namespace Wabbajack
{
public class CompilerFileManagerVM : BackNavigatingVM
{
private readonly DTOSerializer _dtos;
private readonly SettingsManager _settingsManager;
private readonly IServiceProvider _serviceProvider;
private readonly ILogger<CompilerFileManagerVM> _logger;
private readonly ResourceMonitor _resourceMonitor;
private readonly CompilerSettingsInferencer _inferencer;
private readonly Client _wjClient;
[Reactive] public CompilerSettingsVM Settings { get; set; } = new();
public CompilerFileManagerVM(ILogger<CompilerFileManagerVM> logger, DTOSerializer dtos, SettingsManager settingsManager,
IServiceProvider serviceProvider, LogStream loggerProvider, ResourceMonitor resourceMonitor,
CompilerSettingsInferencer inferencer, Client wjClient) : base(logger)
{
_logger = logger;
_dtos = dtos;
_settingsManager = settingsManager;
_serviceProvider = serviceProvider;
_resourceMonitor = resourceMonitor;
_inferencer = inferencer;
_wjClient = wjClient;
MessageBus.Current.Listen<LoadCompilerSettings>()
.Subscribe(msg => {
var csVm = new CompilerSettingsVM(msg.CompilerSettings);
Settings = csVm;
})
.DisposeWith(CompositeDisposable);
}
private async Task NextPage()
{
NavigateToGlobal.Send(ScreenType.CompilerFileManager);
LoadCompilerSettings.Send(Settings.ToCompilerSettings());
}
private async Task SaveSettingsFile()
{
if (Settings.Source == default || Settings.CompilerSettingsPath == default) return;
await using var st = Settings.CompilerSettingsPath.Open(FileMode.Create, FileAccess.Write, FileShare.None);
await JsonSerializer.SerializeAsync(st, Settings.ToCompilerSettings(), _dtos.Options);
var allSavedCompilerSettings = await _settingsManager.Load<List<AbsolutePath>>(Consts.AllSavedCompilerSettingsPaths);
// Don't simply remove Settings.CompilerSettingsPath here, because WJ sometimes likes to make default compiler settings files
allSavedCompilerSettings.RemoveAll(path => path.Parent == Settings.Source);
allSavedCompilerSettings.Insert(0, Settings.CompilerSettingsPath);
await _settingsManager.Save(Consts.AllSavedCompilerSettingsPaths, allSavedCompilerSettings);
}
private async Task LoadLastSavedSettings()
{
AbsolutePath lastPath = default;
var allSavedCompilerSettings = await _settingsManager.Load<List<AbsolutePath>>(Consts.AllSavedCompilerSettingsPaths);
if (allSavedCompilerSettings.Any())
lastPath = allSavedCompilerSettings[0];
if (lastPath == default || !lastPath.FileExists() || lastPath.FileName.Extension != Ext.CompilerSettings) return;
//ModlistLocation.TargetPath = lastPath;
}
}
}

View File

@ -65,7 +65,7 @@ namespace Wabbajack
NewModListCommand = ReactiveCommand.Create(() => {
NavigateToGlobal.Send(ScreenType.CompilerDetails);
LoadModlistForCompiling.Send(new());
LoadCompilerSettings.Send(new());
});
LoadSettingsCommand = ReactiveCommand.Create(() =>
@ -75,7 +75,7 @@ namespace Wabbajack
{
NavigateToGlobal.Send(ScreenType.CompilerDetails);
var compilerSettings = _dtos.Deserialize<CompilerSettings>(File.ReadAllText(CompilerSettingsPicker.TargetPath.ToString()));
LoadModlistForCompiling.Send(compilerSettings);
LoadCompilerSettings.Send(compilerSettings);
}
});

View File

@ -44,8 +44,9 @@ namespace Wabbajack
public ObservableCollectionExtended<IStatusMessage> Log { get; } = new ObservableCollectionExtended<IStatusMessage>();
public readonly CompilerDetailsVM CompilerDetailsVM;
public readonly CompilerHomeVM CompilerHomeVM;
public readonly CompilerDetailsVM CompilerDetailsVM;
public readonly CompilerFileManagerVM CompilerFileManagerVM;
public readonly InstallerVM InstallerVM;
public readonly SettingsVM SettingsPaneVM;
public readonly ModListGalleryVM GalleryVM;
@ -79,7 +80,7 @@ namespace Wabbajack
public MainWindowVM(ILogger<MainWindowVM> logger, Client wjClient,
IServiceProvider serviceProvider, HomeVM homeVM, ModListGalleryVM modListGalleryVM, ResourceMonitor resourceMonitor,
InstallerVM installerVM, CompilerDetailsVM compilerVM, CompilerHomeVM compilerHomeVM, SettingsVM settingsVM, WebBrowserVM webBrowserVM, NavigationVM navigationVM)
InstallerVM installerVM, CompilerHomeVM compilerHomeVM, CompilerDetailsVM compilerVM, CompilerFileManagerVM compilerFileManagerVM, SettingsVM settingsVM, WebBrowserVM webBrowserVM, NavigationVM navigationVM)
{
_logger = logger;
_wjClient = wjClient;
@ -87,8 +88,9 @@ namespace Wabbajack
_serviceProvider = serviceProvider;
ConverterRegistration.Register();
InstallerVM = installerVM;
CompilerDetailsVM = compilerVM;
CompilerHomeVM = compilerHomeVM;
CompilerDetailsVM = compilerVM;
CompilerFileManagerVM = compilerFileManagerVM;
SettingsPaneVM = settingsVM;
GalleryVM = modListGalleryVM;
HomeVM = homeVM;
@ -235,8 +237,9 @@ namespace Wabbajack
ScreenType.Home => HomeVM,
ScreenType.ModListGallery => GalleryVM,
ScreenType.Installer => InstallerVM,
ScreenType.CompilerDetails => CompilerDetailsVM,
ScreenType.CompilerHome => CompilerHomeVM,
ScreenType.CompilerDetails => CompilerDetailsVM,
ScreenType.CompilerFileManager => CompilerFileManagerVM,
ScreenType.Settings => SettingsPaneVM,
_ => ActivePane
};

View File

@ -56,7 +56,7 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Grid.Row="0" Grid.RowSpan="4" Grid.Column="0" Grid.ColumnSpan="2"
Fill="{StaticResource WindowBackgroundBrush}" />
Fill="{StaticResource WindowBackgroundBrush}"/>
<Viewbox Grid.Row="0" Grid.RowSpan="4" Grid.Column="0" Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
@ -126,36 +126,5 @@
<Run FontSize="15" Text="by" />
<Run x:Name="AuthorTextRun" />
</TextBlock>
<TextBlock Grid.Row="2" Grid.RowSpan="2" Grid.Column="1"
x:Name="DescriptionTextShadow"
Margin="-10,15,-5,15"
Padding="30,10"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
FontFamily="{StaticResource PrimaryFont}"
FontSize="16"
Style="{StaticResource BackgroundBlurStyle}"
TextAlignment="Right"
TextWrapping="Wrap">
<TextBlock.Effect>
<BlurEffect Radius="55" />
</TextBlock.Effect>
</TextBlock>
<TextBlock Grid.Row="2" Grid.RowSpan="2" Grid.Column="1"
x:Name="DescriptionTextBlock"
Margin="20,25,25,25"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
FontFamily="{StaticResource PrimaryFont}"
FontSize="16"
TextAlignment="Right"
TextWrapping="Wrap">
<TextBlock.Effect>
<DropShadowEffect />
</TextBlock.Effect>
</TextBlock>
<Rectangle Grid.Row="2" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="2"
x:Name="TextHoverTrigger"
Fill="Transparent" />
</Grid>
</local:UserControlRx>

View File

@ -80,6 +80,7 @@ namespace Wabbajack
.BindToStrict(this, x => x.AuthorShadowTextRun.Text)
.DisposeWith(dispose);
/*
var descVisible = this.WhenAny(x => x.Description)
.Select(x => string.IsNullOrWhiteSpace(x) ? Visibility.Collapsed : Visibility.Visible)
.Replay(1)
@ -96,6 +97,7 @@ namespace Wabbajack
this.WhenAny(x => x.Description)
.BindToStrict(this, x => x.DescriptionTextShadow.Text)
.DisposeWith(dispose);
*/
var titleVisible = this.WhenAny(x => x.Title)
.Select(x => string.IsNullOrWhiteSpace(x) ? Visibility.Collapsed : Visibility.Visible)

View File

@ -54,7 +54,7 @@
VerticalContentAlignment="Center"
Background="{StaticResource DarkBackgroundBrush}"
Text="{Binding PickerVM.TargetPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Converter={StaticResource AbsolutePathToStringConverter}}"
Visibility="{Binding PickerVM.ShowTextBoxInput, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
/>
<Grid Grid.Column="1"
HorizontalAlignment="Right"
ClipToBounds="True">

View File

@ -18,27 +18,14 @@
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="4*" />
<RowDefinition Height="*" MinHeight="150" />
<RowDefinition Height="8*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="1.8*" />
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="5" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.Column="3">
<local:DetailImageView x:Name="DetailImage" BorderThickness="0" />
</Grid>
<!-- Comes after image area so shadow can overlay -->
<!--
<local:TopProgressView Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="5"
x:Name="TopProgressBar"
OverhangShadow="False" />
-->
<ScrollViewer Grid.Row="0" Grid.Column="1"
<ScrollViewer Grid.Row="0" Grid.Column="0" Grid.RowSpan="2"
x:Name="SettingsScrollViewer"
Background="Transparent"
HorizontalScrollBarVisibility="Disabled"
@ -187,73 +174,44 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</ScrollViewer>
<Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5"
x:Name="BottomBarBackground"
Margin="5"
Background="{StaticResource WindowBackgroundBrush}" />
<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5"
MaxWidth="1000">
<Grid
x:Name="BottomCompilerSettingsGrid"
Margin="35,0,35,0"
VerticalAlignment="Center"
ClipToBounds="False">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<local:MO2CompilerConfigView x:Name="CompilerConfigView" Grid.Row="1" Grid.Column="1" />
<local:BeginButton Grid.Row="0" Grid.RowSpan="3" Grid.Column="5"
x:Name="BeginButton" />
<icon:PackIconFontAwesome Grid.Row="2"
Grid.Column="5"
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"
Grid.Column="5"
x:Name="ErrorSummaryIcon"
HorizontalAlignment="Center"
Foreground="{StaticResource WarningBrush}"
Kind="ExclamationTriangleSolid" />
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<local:DetailImageView x:Name="DetailImage" BorderThickness="0" Padding="16, 0, 0, 8" />
</Grid>
<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5"
x:Name="MidCompilationGrid"
Margin="5">
<Grid Grid.Row="1" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<local:LogView x:Name="LogView" Grid.Column="0" />
<local:CpuView Grid.Column="2"
x:Name="CpuView"
ViewModel="{Binding}" />
<local:AttentionBorder x:Name="UserInterventionsControl" Grid.Column="2">
<Grid>
<local:ConfirmationInterventionView DataContext="{Binding ActiveGlobalUserIntervention}" Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsTypeVisibilityConverter}, ConverterParameter={x:Type local:ConfirmationIntervention}}" />
</Grid>
</local:AttentionBorder>
<local:CompilationCompleteView Grid.Column="2"
x:Name="CompilationComplete"
ViewModel="{Binding}" />
<TextBlock
HorizontalAlignment="Left"
Margin="16, 0, 0, 8"
VerticalAlignment="Center"
FontSize="14"
Text="Output Location"
TextAlignment="Center"
ToolTip="The folder to place the resulting modlist.wabbajack file" />
<local:FilePicker
Grid.Row="1"
x:Name="OutputLocation"
Margin="16, 0, 0, 0"
Height="30"
VerticalAlignment="Center"
FontSize="14"
ToolTip="The folder to place the resulting modlist.wabbajack file" />
<Button
x:Name="ContinueButton"
Grid.RowSpan="2"
Grid.Column="1"
Style="{StaticResource WizardButtonStyle}"
Content="Continue">
</Button>
</Grid>
</Grid>
</rxui:ReactiveUserControl>

View File

@ -29,17 +29,6 @@ namespace Wabbajack
this.WhenActivated(disposables =>
{
ViewModel.WhenAny(vm => vm.State)
.Select(x => x == CompilerState.Errored)
.BindToStrict(this, x => x.CompilationComplete.AttentionBorder.Failure)
.DisposeWith(disposables);
ViewModel.WhenAny(vm => vm.State)
.Select(x => x == CompilerState.Errored)
.Select(failed => $"Compilation {(failed ? "Failed" : "Complete")}")
.BindToStrict(this, x => x.CompilationComplete.TitleText.Text)
.DisposeWith(disposables);
ViewModel.WhenAny(vm => vm.ModListImageLocation.TargetPath)
.Where(i => i.FileExists())
.Select(i => (UIUtils.TryGetBitmapImageFromFile(i, out var img), img))
@ -56,88 +45,6 @@ namespace Wabbajack
ViewModel.WhenAny(vm => vm.Settings.ModListDescription)
.BindToStrict(this, view => view.DetailImage.Description);
CompilationComplete.GoToModlistButton.Command = ReactiveCommand.Create(() =>
{
UIUtils.OpenFolder(ViewModel.OutputLocation.TargetPath);
}).DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.BackCommand)
.BindToStrict(this, view => view.CompilationComplete.BackButton.Command)
.DisposeWith(disposables);
CompilationComplete.CloseWhenCompletedButton.Command = ReactiveCommand.Create(() =>
{
Environment.Exit(0);
}).DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.ExecuteCommand)
.BindToStrict(this, view => view.BeginButton.Command)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.State)
.Select(v => v == CompilerState.Configuration ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, view => view.BottomCompilerSettingsGrid.Visibility)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.State)
.Select(v => v != CompilerState.Configuration ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, view => view.LogView.Visibility)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.State)
.Select(v => v == CompilerState.Compiling ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, view => view.CpuView.Visibility)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.State)
.Select(v => v is CompilerState.Completed or CompilerState.Errored ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, view => view.CompilationComplete.Visibility)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.ModlistLocation)
.BindToStrict(this, view => view.CompilerConfigView.ModListLocation.PickerVM)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.DownloadLocation)
.BindToStrict(this, view => view.CompilerConfigView.DownloadsLocation.PickerVM)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.Settings.Downloads)
.BindToStrict(this, view => view.CompilerConfigView.DownloadsLocation.PickerVM.TargetPath)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.OutputLocation)
.BindToStrict(this, view => view.CompilerConfigView.OutputLocation.PickerVM)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.Settings.OutputFile)
.BindToStrict(this, view => view.CompilerConfigView.OutputLocation.PickerVM.TargetPath)
.DisposeWith(disposables);
UserInterventionsControl.Visibility = Visibility.Collapsed;
// Errors
this.WhenAnyValue(view => view.ViewModel.ErrorState)
.Select(x => !x.Failed)
.BindToStrict(this, view => view.BeginButton.IsEnabled)
.DisposeWith(disposables);
this.WhenAnyValue(view => view.ViewModel.ErrorState)
.Select(x => x.Failed ? Visibility.Visible : Visibility.Hidden)
.BindToStrict(this, view => view.ErrorSummaryIcon.Visibility)
.DisposeWith(disposables);
this.WhenAnyValue(view => view.ViewModel.ErrorState)
.Select(x => x.Failed ? Visibility.Visible : Visibility.Hidden)
.BindToStrict(this, view => view.ErrorSummaryIconGlow.Visibility)
.DisposeWith(disposables);
this.WhenAnyValue(view => view.ViewModel.ErrorState)
.Select(x => x.Reason)
.BindToStrict(this, view => view.ErrorSummaryIcon.ToolTip)
.DisposeWith(disposables);
// Settings
@ -177,6 +84,9 @@ namespace Wabbajack
this.Bind(ViewModel, vm => vm.Settings.MachineUrl, view => view.MachineUrl.Text)
.DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.NextCommand, v => v.ContinueButton)
.DisposeWith(disposables);
/*

View File

@ -0,0 +1,22 @@
<rxui:ReactiveUserControl
x:Class="Wabbajack.CompilerFileManagerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lib="clr-namespace:Wabbajack;assembly=Wabbajack"
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"
xmlns:rxui="http://reactiveui.net"
xmlns:wabbacommon="clr-namespace:Wabbajack.Common;assembly=Wabbajack.Common"
xmlns:controls1="clr-namespace:Wabbajack.ViewModels.Controls"
d:DataContext="{d:DesignInstance local:CompilerFileManagerVM}"
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="local:CompilerFileManagerVM"
mc:Ignorable="d">
<Grid>
</Grid>
</rxui:ReactiveUserControl>

View File

@ -0,0 +1,39 @@
using System;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading.Tasks;
using System.Windows.Controls;
using ReactiveUI;
using System.Windows;
using System.Windows.Forms;
using DynamicData;
using Microsoft.WindowsAPICodePack.Dialogs;
using Wabbajack.Common;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
using Wabbajack.ViewModels.Controls;
using Wabbajack.Services.OSIntegrated;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for CompilerFileManagerView.xaml
/// </summary>
public partial class CompilerFileManagerView : ReactiveUserControl<CompilerFileManagerVM>
{
public CompilerFileManagerView()
{
InitializeComponent();
/*
this.WhenActivated(disposables =>
{
});
*/
}
}
}

View File

@ -47,18 +47,5 @@
VerticalAlignment="Center"
FontSize="14"
ToolTip="The folder where MO2 downloads your mods." />
<TextBlock Grid.Row="2" Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Output Location"
TextAlignment="Center"
ToolTip="The folder to place the resulting modlist.wabbajack file" />
<local:FilePicker Grid.Row="2" Grid.Column="2"
x:Name="OutputLocation"
Height="30"
VerticalAlignment="Center"
FontSize="14"
ToolTip="The folder to place the resulting modlist.wabbajack file" />
</Grid>
</UserControl>

View File

@ -67,7 +67,7 @@
<None Remove="Resources\Wabba_Mouth.png" />
<None Remove="Resources\Wabba_Mouth_No_Text.png" />
<None Remove="Resources\Wabba_Mouth_Small.png" />
<Compile Remove="ViewModels\Compilers\VortexCompilerVM.cs" />
<Compile Remove="ViewModels\Compiler\VortexCompilerVM.cs" />
<Compile Remove="ViewModels\Installers\VortexInstallerVM.cs" />
<None Update="Resources\libwebp_x64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>