Merge pull request #2044 from wabbajack-tools/resource-editing-window

Change out how we set resource settings
This commit is contained in:
Timothy Baldridge 2022-08-17 16:26:53 -06:00 committed by GitHub
commit a3eaf607c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 103 deletions

View File

@ -172,5 +172,13 @@ namespace Wabbajack
return String.Format("{0:0.##} {1}", dblSByte, Suffix[i]);
}
public static void OpenFile(AbsolutePath file)
{
Process.Start(new ProcessStartInfo("cmd.exe", $"/c start \"\" \"{file}\"")
{
CreateNoWindow = true,
});
}
}
}

View File

@ -41,76 +41,9 @@
FontSize="20"
FontWeight="Bold"
Text="Performance" />
<TextBlock Grid.Row="3" Grid.Column="0"
x:Name="DownloadThreadsLabel"
VerticalAlignment="Center"
Text="Download Threads" />
<xwpf:DoubleUpDown Grid.Row="3" Grid.Column="2"
x:Name="DownloadThreads"
MinWidth="75"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="White"
FormatString="F0"
Increment="2"
Maximum="128"
Minimum="1" />
<TextBlock Grid.Row="4" Grid.Column="0"
x:Name="DiskThreadsLabel"
VerticalAlignment="Center"
Text="Disk Threads" />
<xwpf:DoubleUpDown Grid.Row="4" Grid.Column="2"
x:Name="DiskThreads"
MinWidth="75"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="White"
FormatString="F0"
Increment="2"
Maximum="128"
Minimum="1" />
<TextBlock Grid.Row="5" Grid.Column="0"
x:Name="ReduceHDDThreadsLabel"
VerticalAlignment="Center"
Text="Reduce HDD threads (Recommended)" />
<CheckBox Grid.Row="5" Grid.Column="2"
x:Name="ReduceHDDThreads"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="White"
></CheckBox>
<TextBlock Grid.Row="6" Grid.Column="0"
x:Name="FavorPerfOverRamLabel"
VerticalAlignment="Center"
Text="Favor performance over RAM Usage" />
<CheckBox Grid.Row="6" Grid.Column="2"
x:Name="FavorPerfOverRam"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="White"
></CheckBox>
<TextBlock Grid.Row="7" Grid.Column="0"
x:Name="UseNetworkWorkaroundLabel"
VerticalAlignment="Center"
Text="Use Network Workaround (slow)" />
<CheckBox Grid.Row="7" Grid.Column="2"
x:Name="UseNetworkWorkAround"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="White"
></CheckBox>
<TextBlock Grid.Row="8" Grid.Column="0"
x:Name="DisableTextureResizingLabel"
VerticalAlignment="Center"
Text="Disable Texture Resizing (during compilation)" />
<CheckBox Grid.Row="8" Grid.Column="2"
x:Name="DisableTextureResizing"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="White"
></CheckBox>
<Button Grid.Row="2" x:Name="EditResourceSettings">
<TextBlock FontSize="14" FontWeight="Bold">Edit Resource Usage Settings and Close Wabbajack</TextBlock>
</Button>
</Grid>
</Border>
</rxui:ReactiveUserControl>

View File

@ -1,21 +1,6 @@
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;
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;
using Wabbajack.Common;
using Wabbajack.Paths.IO;
namespace Wabbajack
{
@ -30,23 +15,12 @@ namespace Wabbajack
this.WhenActivated(disposable =>
{
// Bind Values
this.BindStrict(this.ViewModel, x => x.DiskThreads, x => x.DiskThreads.Value,
vmToViewConverter: x => x,
viewToVmConverter: x => (int)(x ?? 0))
.DisposeWith(disposable);
this.BindStrict(this.ViewModel, x => x.DownloadThreads, x => x.DownloadThreads.Value,
vmToViewConverter: x => x,
viewToVmConverter: x => (int)(x ?? 0))
.DisposeWith(disposable);
this.BindStrict(this.ViewModel, x => x.ReduceHDDThreads, x => x.ReduceHDDThreads.IsChecked)
.DisposeWith(disposable);
this.BindStrict(this.ViewModel, x => x.FavorPerfOverRam, x => x.FavorPerfOverRam.IsChecked)
.DisposeWith(disposable);
this.BindStrict(this.ViewModel, x => x.NetworkWorkaroundMode, x => x.UseNetworkWorkAround.IsChecked)
.DisposeWith(disposable);
this.BindStrict(this.ViewModel, x => x.DisableTextureResizing, x => x.DisableTextureResizing.IsChecked)
.DisposeWith(disposable);
this.EditResourceSettings.Command = ReactiveCommand.Create(() =>
{
UIUtils.OpenFile(
KnownFolders.WabbajackAppLocal.Combine("saved_settings", "resource_settings.json"));
Environment.Exit(0);
});
});
}
}