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) ||
|
||||
|
@ -77,7 +79,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
_saveBackgroundWorker.RunWorkerAsync();
|
||||
if (_exiting)
|
||||
{
|
||||
CurrentTasMovie.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
_saveBackgroundWorker.RunWorkerAsync();
|
||||
}
|
||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +104,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
CurrentTasMovie.Filename = file.FullName;
|
||||
|
||||
_saveBackgroundWorker.RunWorkerAsync();
|
||||
if (_exiting)
|
||||
{
|
||||
CurrentTasMovie.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
_saveBackgroundWorker.RunWorkerAsync();
|
||||
}
|
||||
|
||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
SetTextProperty();
|
||||
}
|
||||
|
|
|
@ -230,10 +230,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
text += " - " + CurrentTasMovie.Name + (CurrentTasMovie.Changes ? "*" : "");
|
||||
}
|
||||
|
||||
if (this.InvokeRequired)
|
||||
this.Invoke(() => Text = text);
|
||||
else
|
||||
Text = text;
|
||||
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