Clean up some `AskSaveChanges` implementations
This commit is contained in:
parent
bd3f919129
commit
3fb30a2ca7
|
@ -700,28 +700,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public override bool AskSaveChanges()
|
||||
{
|
||||
if (LuaImp.ScriptList.Changes && !string.IsNullOrEmpty(LuaImp.ScriptList.Filename))
|
||||
{
|
||||
var result = MainForm.DoWithTempMute(() => MessageBox.Show("Save changes to session?", "Lua Console", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3));
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
SaveOrSaveAs();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (result == DialogResult.No)
|
||||
{
|
||||
LuaImp.ScriptList.Changes = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (result == DialogResult.Cancel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!LuaImp.ScriptList.Changes || string.IsNullOrEmpty(LuaImp.ScriptList.Filename)) return true;
|
||||
var result = DialogController.DoWithTempMute(() => this.ModalMessageBox3(
|
||||
caption: "Closing with Unsaved Changes",
|
||||
icon: EMsgBoxIcon.Question,
|
||||
text: $"Save {WindowTitleStatic} session?"));
|
||||
if (result is null) return false;
|
||||
if (result.Value) SaveOrSaveAs();
|
||||
else LuaImp.ScriptList.Changes = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
@ -135,30 +133,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
StopSeeking();
|
||||
|
||||
if (CurrentTasMovie != null && CurrentTasMovie.Changes)
|
||||
{
|
||||
var result = MainForm.DoWithTempMute(() => MessageBox.Show(
|
||||
"Save Changes?",
|
||||
"Tastudio",
|
||||
MessageBoxButtons.YesNoCancel,
|
||||
MessageBoxIcon.Question,
|
||||
MessageBoxDefaultButton.Button3));
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
SaveTas();
|
||||
}
|
||||
else if (result == DialogResult.No)
|
||||
{
|
||||
CurrentTasMovie.ClearChanges();
|
||||
return true;
|
||||
}
|
||||
else if (result == DialogResult.Cancel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (CurrentTasMovie?.Changes is not true) return true;
|
||||
var result = DialogController.DoWithTempMute(() => this.ModalMessageBox3(
|
||||
caption: "Closing with Unsaved Changes",
|
||||
icon: EMsgBoxIcon.Question,
|
||||
text: $"Save {WindowTitleStatic} project?"));
|
||||
if (result is null) return false;
|
||||
if (result.Value) SaveTas();
|
||||
else CurrentTasMovie.ClearChanges();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,32 +206,28 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public override bool AskSaveChanges()
|
||||
{
|
||||
if (_watches.Changes)
|
||||
if (!_watches.Changes) return true;
|
||||
var result = DialogController.DoWithTempMute(() => this.ModalMessageBox3(
|
||||
caption: "Closing with Unsaved Changes",
|
||||
icon: EMsgBoxIcon.Question,
|
||||
text: "Save watch file?"));
|
||||
if (result is null) return false;
|
||||
if (result.Value)
|
||||
{
|
||||
var result = MainForm.DoWithTempMute(() => MessageBox.Show("Save Changes?", "RAM Watch", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3));
|
||||
if (result == DialogResult.Yes)
|
||||
if (string.IsNullOrWhiteSpace(_watches.CurrentFileName))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_watches.CurrentFileName))
|
||||
{
|
||||
SaveAs();
|
||||
}
|
||||
else
|
||||
{
|
||||
_watches.Save();
|
||||
Config.RecentWatches.Add(_watches.CurrentFileName);
|
||||
}
|
||||
SaveAs();
|
||||
}
|
||||
else if (result == DialogResult.No)
|
||||
else
|
||||
{
|
||||
_watches.Changes = false;
|
||||
return true;
|
||||
}
|
||||
else if (result == DialogResult.Cancel)
|
||||
{
|
||||
return false;
|
||||
_watches.Save();
|
||||
Config.RecentWatches.Add(_watches.CurrentFileName);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
_watches.Changes = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue