mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Adjusted shutdown mechanics to not block GUI thread
This commit is contained in:
parent
8e0ee257f7
commit
a2b900a64f
@ -212,12 +212,12 @@ namespace Wabbajack
|
|||||||
.QueryWhenChanged(query => query.FirstOrDefault())
|
.QueryWhenChanged(query => query.FirstOrDefault())
|
||||||
.ToGuiProperty(this, nameof(ActiveGlobalUserIntervention));
|
.ToGuiProperty(this, nameof(ActiveGlobalUserIntervention));
|
||||||
|
|
||||||
CloseWhenCompleteCommand = ReactiveCommand.Create(
|
CloseWhenCompleteCommand = ReactiveCommand.CreateFromTask(
|
||||||
canExecute: this.WhenAny(x => x.Completed)
|
canExecute: this.WhenAny(x => x.Completed)
|
||||||
.Select(x => x != null),
|
.Select(x => x != null),
|
||||||
execute: () =>
|
execute: async () =>
|
||||||
{
|
{
|
||||||
MWVM.ShutdownApplication();
|
await MWVM.ShutdownApplication();
|
||||||
});
|
});
|
||||||
|
|
||||||
GoToCommand = ReactiveCommand.Create(
|
GoToCommand = ReactiveCommand.Create(
|
||||||
|
@ -412,12 +412,12 @@ namespace Wabbajack
|
|||||||
.QueryWhenChanged(query => query.FirstOrDefault())
|
.QueryWhenChanged(query => query.FirstOrDefault())
|
||||||
.ToGuiProperty(this, nameof(ActiveGlobalUserIntervention));
|
.ToGuiProperty(this, nameof(ActiveGlobalUserIntervention));
|
||||||
|
|
||||||
CloseWhenCompleteCommand = ReactiveCommand.Create(
|
CloseWhenCompleteCommand = ReactiveCommand.CreateFromTask(
|
||||||
canExecute: this.WhenAny(x => x.Completed)
|
canExecute: this.WhenAny(x => x.Completed)
|
||||||
.Select(x => x != null),
|
.Select(x => x != null),
|
||||||
execute: () =>
|
execute: async () =>
|
||||||
{
|
{
|
||||||
MWVM.ShutdownApplication();
|
await MWVM.ShutdownApplication();
|
||||||
});
|
});
|
||||||
|
|
||||||
GoToInstallCommand = ReactiveCommand.Create(
|
GoToInstallCommand = ReactiveCommand.Create(
|
||||||
|
@ -143,12 +143,12 @@ namespace Wabbajack
|
|||||||
.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.Create(() => OpenTerminal());
|
OpenTerminalCommand = ReactiveCommand.CreateFromTask(() => OpenTerminal());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenTerminal()
|
private async Task OpenTerminal()
|
||||||
{
|
{
|
||||||
var process = new ProcessStartInfo
|
var process = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ namespace Wabbajack
|
|||||||
WorkingDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
|
WorkingDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
|
||||||
};
|
};
|
||||||
Process.Start(process);
|
Process.Start(process);
|
||||||
ShutdownApplication();
|
await ShutdownApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsStartingFromModlist(out AbsolutePath modlistPath)
|
private static bool IsStartingFromModlist(out AbsolutePath modlistPath)
|
||||||
@ -193,14 +193,14 @@ namespace Wabbajack
|
|||||||
ActivePane = vm;
|
ActivePane = vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShutdownApplication()
|
public async Task ShutdownApplication()
|
||||||
{
|
{
|
||||||
Dispose();
|
Dispose();
|
||||||
Settings.PosX = MainWindow.Left;
|
Settings.PosX = MainWindow.Left;
|
||||||
Settings.PosY = MainWindow.Top;
|
Settings.PosY = MainWindow.Top;
|
||||||
Settings.Width = MainWindow.Width;
|
Settings.Width = MainWindow.Width;
|
||||||
Settings.Height = MainWindow.Height;
|
Settings.Height = MainWindow.Height;
|
||||||
MainSettings.SaveSettings(Settings).AsTask().Wait();
|
await MainSettings.SaveSettings(Settings);
|
||||||
Application.Current.Shutdown();
|
Application.Current.Shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ namespace Wabbajack
|
|||||||
|
|
||||||
private void Window_Closing(object sender, CancelEventArgs e)
|
private void Window_Closing(object sender, CancelEventArgs e)
|
||||||
{
|
{
|
||||||
_mwvm.ShutdownApplication();
|
_mwvm.ShutdownApplication().Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user