Merge pull request #834 from kwsch/b/settings-save

Fixed settings not saving when form closes
This commit is contained in:
Kaphotics 2017-02-07 21:24:28 -08:00 committed by GitHub
commit d20006805f

View File

@ -3118,13 +3118,14 @@ private void dragoutDrop(object sender, DragEventArgs e)
private void Main_FormClosing(object sender, FormClosingEventArgs e)
{
if (!SAV.Edited)
if (SAV.Edited && DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Any unsaved changes will be lost.", "Are you sure you want to close PKHeX?"))
{
e.Cancel = true;
return;
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Any unsaved changes will be lost.", "Are you sure you want to close PKHeX?"))
{ e.Cancel = true; return; }
}
try { Properties.Settings.Default.Save(); }
catch (Exception x) { File.WriteAllLines("config error.txt", new[] {x.ToString()}); }
catch (Exception x) { File.WriteAllLines("config error.txt", new[] { x.ToString() }); }
}
#endregion