Moved open terminal button to inside misc settings

Was too dangerous to have next to minimize
This commit is contained in:
Justin Swanson 2020-08-08 08:08:24 -05:00
parent 785e2fba5a
commit da4865dc7e
6 changed files with 42 additions and 43 deletions

View File

@ -1,4 +1,4 @@
using DynamicData;
using DynamicData;
using DynamicData.Binding;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
@ -46,7 +46,6 @@ namespace Wabbajack
public ICommand CopyVersionCommand { get; }
public ICommand ShowLoginManagerVM { get; }
public ICommand OpenSettingsCommand { get; }
public ICommand OpenTerminalCommand { get; }
public string VersionDisplay { get; }
@ -142,21 +141,6 @@ namespace Wabbajack
canExecute: this.WhenAny(x => x.ActivePane)
.Select(active => !SettingsPane.IsValueCreated || !object.ReferenceEquals(active, SettingsPane.Value)),
execute: () => NavigateTo(SettingsPane.Value));
OpenTerminalCommand = ReactiveCommand.CreateFromTask(() => OpenTerminal());
}
private async Task OpenTerminal()
{
var process = new ProcessStartInfo
{
FileName = "cmd.exe",
WorkingDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
};
Process.Start(process);
await ShutdownApplication();
}
private static bool IsStartingFromModlist(out AbsolutePath modlistPath)
@ -171,7 +155,6 @@ namespace Wabbajack
return true;
}
public void OpenInstaller(AbsolutePath path)
{
if (path == default) return;

View File

@ -1,8 +1,12 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using ReactiveUI;
using Wabbajack.Lib;
@ -15,7 +19,9 @@ namespace Wabbajack
public PerformanceSettings Performance { get; }
public FiltersSettings Filters { get; }
public AuthorFilesVM AuthorFile { get; }
public ICommand OpenTerminalCommand { get; }
public SettingsVM(MainWindowVM mainWindowVM)
: base(mainWindowVM)
{
@ -24,7 +30,18 @@ namespace Wabbajack
Performance = mainWindowVM.Settings.Performance;
AuthorFile = new AuthorFilesVM(this);
Filters = mainWindowVM.Settings.Filters;
OpenTerminalCommand = ReactiveCommand.CreateFromTask(() => OpenTerminal());
}
private async Task OpenTerminal()
{
var process = new ProcessStartInfo
{
FileName = "cmd.exe",
WorkingDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
};
Process.Start(process);
await MWVM.ShutdownApplication();
}
}
}

View File

@ -69,14 +69,6 @@
Height="17"
Kind="Cog" />
</Button>
<Button Grid.Column="1"
Margin="5,0"
Command="{Binding OpenTerminalCommand}">
<icon:PackIconMaterial
Width="17"
Height="17"
Kind="Console" />
</Button>
</mahapps:WindowCommands>
</mahapps:MetroWindow.RightWindowCommands>
</mahapps:MetroWindow>

View File

@ -9,7 +9,7 @@
xmlns:xwpf="http://schemas.xceed.com/wpf/xaml/toolkit"
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="local:FiltersSettings"
x:TypeArguments="local:SettingsVM"
mc:Ignorable="d">
<Border
x:Name="PerformanceView"
@ -42,6 +42,7 @@
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.Resources>
<Style BasedOn="{StaticResource MainButtonStyle}" TargetType="Button">
@ -55,21 +56,21 @@
</Style>
</Grid.Resources>
<CheckBox Grid.Row="0"
Name="FilterPersistCheckBox"
Margin="0,5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Gallery filters are saved on exit">
Name="FilterPersistCheckBox"
Margin="0,5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Gallery filters are saved on exit">
<CheckBox.LayoutTransform>
<ScaleTransform ScaleX="1.2" ScaleY="1.2" />
</CheckBox.LayoutTransform>
</CheckBox>
<CheckBox Grid.Row="1"
Name="UseCompressionCheckBox"
Margin="0,5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Use NTFS LZS compression during install">
Name="UseCompressionCheckBox"
Margin="0,5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Use NTFS LZS compression during install">
<CheckBox.LayoutTransform>
<ScaleTransform ScaleX="1.2" ScaleY="1.2" />
</CheckBox.LayoutTransform>
@ -78,6 +79,10 @@
Name="ClearCefCache"
Margin="0,5,0,0"
Content="Clear In-App Browser Cache" />
<Button Grid.Row="3"
Name="OpenTerminal"
Margin="0,5,0,0"
Content="Open Terminal and Close WJ" />
</Grid>
</Grid>
</Border>

View File

@ -23,7 +23,7 @@ namespace Wabbajack
/// <summary>
/// Interaction logic for MiscSettingsView.xaml
/// </summary>
public partial class MiscSettingsView : ReactiveUserControl<FiltersSettings>
public partial class MiscSettingsView : ReactiveUserControl<SettingsVM>
{
public MiscSettingsView()
{
@ -32,9 +32,12 @@ namespace Wabbajack
this.WhenActivated(disposable =>
{
// Bind Values
this.Bind(this.ViewModel, x => x.IsPersistent, x => x.FilterPersistCheckBox.IsChecked)
this.BindStrict(this.ViewModel, x => x.Filters.IsPersistent, x => x.FilterPersistCheckBox.IsChecked)
.DisposeWith(disposable);
this.Bind(this.ViewModel, x => x.UseCompression, x => x.UseCompressionCheckBox.IsChecked)
this.BindStrict(this.ViewModel, x => x.Filters.UseCompression, x => x.UseCompressionCheckBox.IsChecked)
.DisposeWith(disposable);
this.WhenAnyValue(x => x.ViewModel.OpenTerminalCommand)
.BindToStrict(this, x => x.OpenTerminal.Command)
.DisposeWith(disposable);
this.ClearCefCache.Click += (sender, args) => {Driver.ClearCache();};

View File

@ -34,8 +34,7 @@ namespace Wabbajack
.DisposeWith(disposable);
this.OneWayBindStrict(this.ViewModel, x => x.Performance, x => x.PerformanceView.ViewModel)
.DisposeWith(disposable);
this.OneWayBindStrict(this.ViewModel, x => x.Filters, x => x.MiscGalleryView.ViewModel)
.DisposeWith(disposable);
this.MiscGalleryView.ViewModel = this.ViewModel;
});
}
}