Browse Source

Don't crash if close window when picking data dir

pull/14/head
JT 1 year ago
parent
commit
db042bbd5b
  1. 5
      StabilityMatrix/App.xaml.cs
  2. 4
      StabilityMatrix/MainWindow.xaml.cs

5
StabilityMatrix/App.xaml.cs

@ -345,8 +345,13 @@ namespace StabilityMatrix
private void App_OnExit(object sender, ExitEventArgs e)
{
serviceProvider?.GetRequiredService<LaunchViewModel>().OnShutdown();
var settingsManager = serviceProvider?.GetRequiredService<ISettingsManager>();
if (settingsManager?.TryFindLibrary() ?? false)
{
serviceProvider?.GetRequiredService<ILiteDbContext>().Dispose();
}
}
[DoesNotReturn]
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)

4
StabilityMatrix/MainWindow.xaml.cs

@ -127,7 +127,11 @@ namespace StabilityMatrix
{
var interopHelper = new WindowInteropHelper(this);
var placement = ScreenExtensions.GetPlacement(interopHelper.Handle);
if (settingsManager.TryFindLibrary())
{
settingsManager.SetPlacement(placement.ToString());
}
}
}
}

Loading…
Cancel
Save