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 DynamicData.Binding;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
@ -46,7 +46,6 @@ namespace Wabbajack
public ICommand CopyVersionCommand { get; } public ICommand CopyVersionCommand { get; }
public ICommand ShowLoginManagerVM { get; } public ICommand ShowLoginManagerVM { get; }
public ICommand OpenSettingsCommand { get; } public ICommand OpenSettingsCommand { get; }
public ICommand OpenTerminalCommand { get; }
public string VersionDisplay { get; } public string VersionDisplay { get; }
@ -142,21 +141,6 @@ namespace Wabbajack
canExecute: this.WhenAny(x => x.ActivePane) canExecute: this.WhenAny(x => x.ActivePane)
.Select(active => !SettingsPane.IsValueCreated || !object.ReferenceEquals(active, SettingsPane.Value)), .Select(active => !SettingsPane.IsValueCreated || !object.ReferenceEquals(active, SettingsPane.Value)),
execute: () => NavigateTo(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) private static bool IsStartingFromModlist(out AbsolutePath modlistPath)
@ -171,7 +155,6 @@ namespace Wabbajack
return true; return true;
} }
public void OpenInstaller(AbsolutePath path) public void OpenInstaller(AbsolutePath path)
{ {
if (path == default) return; if (path == default) return;

View File

@ -1,8 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using ReactiveUI; using ReactiveUI;
using Wabbajack.Lib; using Wabbajack.Lib;
@ -16,6 +20,8 @@ namespace Wabbajack
public FiltersSettings Filters { get; } public FiltersSettings Filters { get; }
public AuthorFilesVM AuthorFile { get; } public AuthorFilesVM AuthorFile { get; }
public ICommand OpenTerminalCommand { get; }
public SettingsVM(MainWindowVM mainWindowVM) public SettingsVM(MainWindowVM mainWindowVM)
: base(mainWindowVM) : base(mainWindowVM)
{ {
@ -24,7 +30,18 @@ namespace Wabbajack
Performance = mainWindowVM.Settings.Performance; Performance = mainWindowVM.Settings.Performance;
AuthorFile = new AuthorFilesVM(this); AuthorFile = new AuthorFilesVM(this);
Filters = mainWindowVM.Settings.Filters; 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" Height="17"
Kind="Cog" /> Kind="Cog" />
</Button> </Button>
<Button Grid.Column="1"
Margin="5,0"
Command="{Binding OpenTerminalCommand}">
<icon:PackIconMaterial
Width="17"
Height="17"
Kind="Console" />
</Button>
</mahapps:WindowCommands> </mahapps:WindowCommands>
</mahapps:MetroWindow.RightWindowCommands> </mahapps:MetroWindow.RightWindowCommands>
</mahapps:MetroWindow> </mahapps:MetroWindow>

View File

@ -9,7 +9,7 @@
xmlns:xwpf="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:xwpf="http://schemas.xceed.com/wpf/xaml/toolkit"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:TypeArguments="local:FiltersSettings" x:TypeArguments="local:SettingsVM"
mc:Ignorable="d"> mc:Ignorable="d">
<Border <Border
x:Name="PerformanceView" x:Name="PerformanceView"
@ -42,6 +42,7 @@
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
<RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.Resources> <Grid.Resources>
<Style BasedOn="{StaticResource MainButtonStyle}" TargetType="Button"> <Style BasedOn="{StaticResource MainButtonStyle}" TargetType="Button">
@ -78,6 +79,10 @@
Name="ClearCefCache" Name="ClearCefCache"
Margin="0,5,0,0" Margin="0,5,0,0"
Content="Clear In-App Browser Cache" /> 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>
</Grid> </Grid>
</Border> </Border>

View File

@ -23,7 +23,7 @@ namespace Wabbajack
/// <summary> /// <summary>
/// Interaction logic for MiscSettingsView.xaml /// Interaction logic for MiscSettingsView.xaml
/// </summary> /// </summary>
public partial class MiscSettingsView : ReactiveUserControl<FiltersSettings> public partial class MiscSettingsView : ReactiveUserControl<SettingsVM>
{ {
public MiscSettingsView() public MiscSettingsView()
{ {
@ -32,9 +32,12 @@ namespace Wabbajack
this.WhenActivated(disposable => this.WhenActivated(disposable =>
{ {
// Bind Values // 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); .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); .DisposeWith(disposable);
this.ClearCefCache.Click += (sender, args) => {Driver.ClearCache();}; this.ClearCefCache.Click += (sender, args) => {Driver.ClearCache();};

View File

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