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