From eb6181cf887b73934f9d74bf4f971a7e6acd67cc Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 22 Apr 2015 20:31:27 -0700 Subject: [PATCH] Fix Issue 5: Not saving current entry on FormClose https://github.com/kwsch/pk3DS/issues/5 Underlying issue is that the entry is not saved when you close the form. --- pk3DS/Subforms/RSTE.Designer.cs | 1 + pk3DS/Subforms/RSTE.cs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/pk3DS/Subforms/RSTE.Designer.cs b/pk3DS/Subforms/RSTE.Designer.cs index 207dbf3..8d3619f 100644 --- a/pk3DS/Subforms/RSTE.Designer.cs +++ b/pk3DS/Subforms/RSTE.Designer.cs @@ -2067,6 +2067,7 @@ private void InitializeComponent() this.MaximizeBox = false; this.Name = "RSTE"; this.Text = "Trainer Editor"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); diff --git a/pk3DS/Subforms/RSTE.cs b/pk3DS/Subforms/RSTE.cs index e4673b5..97ec851 100644 --- a/pk3DS/Subforms/RSTE.cs +++ b/pk3DS/Subforms/RSTE.cs @@ -957,5 +957,10 @@ private int GetRandomMegaEvolvablePokemon(int type) List valids = megaEvos.Where(spec => (int)personal[spec][6] == type || (int)personal[spec][7] == type).ToList(); return valids[(int)(rnd32() % valids.Count)]; } + + private void formClosing(object sender, FormClosingEventArgs e) + { + writeFile(); + } } } \ No newline at end of file