mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-23 00:56:06 -05:00
Added warning when closing PKHeX with unsaved changes (#327)
* Added warning when closing PKHeX with unsaved changes * Changed to MessageBox.Show to Util.Prompt
This commit is contained in:
parent
0b7d108245
commit
475aad5480
1
PKHeX/MainWindow/Main.Designer.cs
generated
1
PKHeX/MainWindow/Main.Designer.cs
generated
|
|
@ -5647,6 +5647,7 @@ public void InitializeComponent()
|
|||
this.Name = "Main";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "PKHeX";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing);
|
||||
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.tabMain_DragDrop);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.tabMain_DragEnter);
|
||||
this.tabMain.ResumeLayout(false);
|
||||
|
|
|
|||
|
|
@ -2994,6 +2994,17 @@ private void dragoutDrop(object sender, DragEventArgs e)
|
|||
|
||||
Cursor = DefaultCursor;
|
||||
}
|
||||
|
||||
private void Main_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (SAV.Edited)
|
||||
{
|
||||
if (Util.Prompt(MessageBoxButtons.YesNo, "Any unsaved changes will be lost. Are you sure you want to close PKHeX?") != DialogResult.Yes)
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region //// SAVE FILE FUNCTIONS ////
|
||||
|
|
@ -3054,6 +3065,7 @@ private void clickExportSAV(object sender, EventArgs e)
|
|||
|
||||
bool dsv = Path.GetExtension(main.FileName)?.ToLower() == ".dsv";
|
||||
File.WriteAllBytes(main.FileName, SAV.Write(dsv));
|
||||
SAV.Edited = false;
|
||||
Util.Alert("SAV exported to:", main.FileName);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user