Tastuduio - issue 359 - fix issues with Asking to save changes on close combined with threaded saving, not the prettiest work around but it should work
This commit is contained in:
parent
e9873f8b91
commit
5d07cff19f
|
@ -102,6 +102,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.Sound.StartSound();
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
_exiting = true; // Asking to save changes should only ever be called when closing something
|
||||
SaveTasMenuItem_Click(null, null);
|
||||
}
|
||||
else if (result == DialogResult.No)
|
||||
|
|
|
@ -68,6 +68,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private bool _exiting = false;
|
||||
|
||||
private void SaveTasMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(CurrentTasMovie.Filename) ||
|
||||
|
@ -76,8 +78,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
SaveAsTasMenuItem_Click(sender, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_exiting)
|
||||
{
|
||||
CurrentTasMovie.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
_saveBackgroundWorker.RunWorkerAsync();
|
||||
}
|
||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +104,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
CurrentTasMovie.Filename = file.FullName;
|
||||
|
||||
if (_exiting)
|
||||
{
|
||||
CurrentTasMovie.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
_saveBackgroundWorker.RunWorkerAsync();
|
||||
}
|
||||
|
||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
SetTextProperty();
|
||||
}
|
||||
|
|
|
@ -231,10 +231,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.Invoke(() => Text = text);
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
public bool LoadProject(string path)
|
||||
{
|
||||
|
@ -631,6 +635,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void Tastudio_Closing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
_exiting = true;
|
||||
if (AskSaveChanges())
|
||||
{
|
||||
WantsToControlStopMovie = false;
|
||||
|
@ -640,6 +645,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
else
|
||||
{
|
||||
e.Cancel = true;
|
||||
_exiting = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue