mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix up the load modlist button
This commit is contained in:
parent
ce72a6e80c
commit
7d206315af
@ -1,5 +1,8 @@
|
|||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
using System.IO;
|
||||||
using Wabbajack.Compiler;
|
using Wabbajack.Compiler;
|
||||||
|
using Wabbajack.DTOs.JsonConverters;
|
||||||
|
using Wabbajack.Paths;
|
||||||
|
|
||||||
namespace Wabbajack.Messages;
|
namespace Wabbajack.Messages;
|
||||||
|
|
||||||
@ -11,6 +14,7 @@ public class LoadModlistForCompiling
|
|||||||
CompilerSettings = cs;
|
CompilerSettings = cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void Send(CompilerSettings cs)
|
public static void Send(CompilerSettings cs)
|
||||||
{
|
{
|
||||||
MessageBus.Current.SendMessage(new LoadModlistForCompiling(cs));
|
MessageBus.Current.SendMessage(new LoadModlistForCompiling(cs));
|
||||||
|
@ -12,6 +12,7 @@ using System.Windows.Input;
|
|||||||
using DynamicData;
|
using DynamicData;
|
||||||
using DynamicData.Binding;
|
using DynamicData.Binding;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using ReactiveUI.Fody.Helpers;
|
using ReactiveUI.Fody.Helpers;
|
||||||
using SteamKit2.GC.Dota.Internal;
|
using SteamKit2.GC.Dota.Internal;
|
||||||
@ -37,10 +38,13 @@ namespace Wabbajack
|
|||||||
private readonly DTOSerializer _dtos;
|
private readonly DTOSerializer _dtos;
|
||||||
|
|
||||||
public ICommand NewModListCommand { get; set; }
|
public ICommand NewModListCommand { get; set; }
|
||||||
|
public ICommand LoadSettingsCommand { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public ObservableCollection<CreatedModlistVM> CreatedModlists { get; set; }
|
public ObservableCollection<CreatedModlistVM> CreatedModlists { get; set; }
|
||||||
|
|
||||||
|
public FilePickerVM CompilerSettingsPicker { get; private set; }
|
||||||
|
|
||||||
public CreateModListVM(ILogger<CreateModListVM> logger, SettingsManager settingsManager,
|
public CreateModListVM(ILogger<CreateModListVM> logger, SettingsManager settingsManager,
|
||||||
IServiceProvider serviceProvider, DTOSerializer dtos)
|
IServiceProvider serviceProvider, DTOSerializer dtos)
|
||||||
{
|
{
|
||||||
@ -48,10 +52,33 @@ namespace Wabbajack
|
|||||||
_settingsManager = settingsManager;
|
_settingsManager = settingsManager;
|
||||||
_serviceProvider = serviceProvider;
|
_serviceProvider = serviceProvider;
|
||||||
_dtos = dtos;
|
_dtos = dtos;
|
||||||
|
|
||||||
|
CompilerSettingsPicker = new FilePickerVM
|
||||||
|
{
|
||||||
|
ExistCheckOption = FilePickerVM.CheckOptions.On,
|
||||||
|
PathType = FilePickerVM.PathTypeOptions.File,
|
||||||
|
PromptTitle = "Select a compiler settings file"
|
||||||
|
};
|
||||||
|
CompilerSettingsPicker.Filters.AddRange([
|
||||||
|
new CommonFileDialogFilter("Compiler Settings File", "*" + Ext.CompilerSettings)
|
||||||
|
]);
|
||||||
|
|
||||||
NewModListCommand = ReactiveCommand.Create(() => {
|
NewModListCommand = ReactiveCommand.Create(() => {
|
||||||
NavigateToGlobal.Send(ScreenType.Compiler);
|
NavigateToGlobal.Send(ScreenType.Compiler);
|
||||||
LoadModlistForCompiling.Send(new());
|
LoadModlistForCompiling.Send(new());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
LoadSettingsCommand = ReactiveCommand.Create(() =>
|
||||||
|
{
|
||||||
|
CompilerSettingsPicker.SetTargetPathCommand.Execute(null);
|
||||||
|
if(CompilerSettingsPicker.TargetPath != default)
|
||||||
|
{
|
||||||
|
NavigateToGlobal.Send(ScreenType.Compiler);
|
||||||
|
var compilerSettings = _dtos.Deserialize<CompilerSettings>(File.ReadAllText(CompilerSettingsPicker.TargetPath.ToString()));
|
||||||
|
LoadModlistForCompiling.Send(compilerSettings);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
LoadAllCompilerSettings().DisposeWith(disposables);
|
LoadAllCompilerSettings().DisposeWith(disposables);
|
||||||
|
@ -139,9 +139,6 @@ namespace Wabbajack
|
|||||||
.DisposeWith(disposables);
|
.DisposeWith(disposables);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.Settings.ModListName, view => view.ModListNameSetting.Text)
|
this.Bind(ViewModel, vm => vm.Settings.ModListName, view => view.ModListNameSetting.Text)
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Border Grid.Column="1" BorderBrush="{StaticResource PrimaryVariantBrush}" CornerRadius="8" BorderThickness="19" Margin="0, 0, 20, 20">
|
<Border Grid.Column="1" BorderBrush="{StaticResource PrimaryVariantBrush}" CornerRadius="8" BorderThickness="19" Margin="0, 0, 20, 20" x:Name="LoadSettingsBorder">
|
||||||
<Grid Background="{StaticResource PrimaryVariantBrush}" Margin="-1">
|
<Grid Background="{StaticResource PrimaryVariantBrush}" Margin="-1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
|
@ -39,6 +39,12 @@ namespace Wabbajack
|
|||||||
.Select(args => Unit.Default)
|
.Select(args => Unit.Default)
|
||||||
.InvokeCommand(this, x => x.ViewModel.NewModListCommand)
|
.InvokeCommand(this, x => x.ViewModel.NewModListCommand)
|
||||||
.DisposeWith(dispose);
|
.DisposeWith(dispose);
|
||||||
|
|
||||||
|
LoadSettingsBorder
|
||||||
|
.Events().MouseDown
|
||||||
|
.Select(args => Unit.Default)
|
||||||
|
.InvokeCommand(this, x => x.ViewModel.LoadSettingsCommand)
|
||||||
|
.DisposeWith(dispose);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user