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();
|
GlobalWin.Sound.StartSound();
|
||||||
if (result == DialogResult.Yes)
|
if (result == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
|
_exiting = true; // Asking to save changes should only ever be called when closing something
|
||||||
SaveTasMenuItem_Click(null, null);
|
SaveTasMenuItem_Click(null, null);
|
||||||
}
|
}
|
||||||
else if (result == DialogResult.No)
|
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)
|
private void SaveTasMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(CurrentTasMovie.Filename) ||
|
if (string.IsNullOrEmpty(CurrentTasMovie.Filename) ||
|
||||||
|
@ -77,7 +79,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_saveBackgroundWorker.RunWorkerAsync();
|
if (_exiting)
|
||||||
|
{
|
||||||
|
CurrentTasMovie.Save();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_saveBackgroundWorker.RunWorkerAsync();
|
||||||
|
}
|
||||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +104,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
CurrentTasMovie.Filename = file.FullName;
|
CurrentTasMovie.Filename = file.FullName;
|
||||||
|
|
||||||
_saveBackgroundWorker.RunWorkerAsync();
|
if (_exiting)
|
||||||
|
{
|
||||||
|
CurrentTasMovie.Save();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_saveBackgroundWorker.RunWorkerAsync();
|
||||||
|
}
|
||||||
|
|
||||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||||
SetTextProperty();
|
SetTextProperty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,10 +230,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
text += " - " + CurrentTasMovie.Name + (CurrentTasMovie.Changes ? "*" : "");
|
text += " - " + CurrentTasMovie.Name + (CurrentTasMovie.Changes ? "*" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.InvokeRequired)
|
if (this.InvokeRequired)
|
||||||
this.Invoke(() => Text = text);
|
{
|
||||||
else
|
this.Invoke(() => Text = text);
|
||||||
Text = text;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Text = text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadProject(string path)
|
public bool LoadProject(string path)
|
||||||
|
@ -631,6 +635,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void Tastudio_Closing(object sender, FormClosingEventArgs e)
|
private void Tastudio_Closing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
_exiting = true;
|
||||||
if (AskSaveChanges())
|
if (AskSaveChanges())
|
||||||
{
|
{
|
||||||
WantsToControlStopMovie = false;
|
WantsToControlStopMovie = false;
|
||||||
|
@ -640,6 +645,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
|
_exiting = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue