From d848f87bd762d66c1beee5bf81dcfe8d8c65c53a Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 21 May 2020 10:32:16 -0700 Subject: [PATCH] Simplify dialog result pattern --- pkNX.WinForms/MainEditor/EditorGG.cs | 5 ++--- pkNX.WinForms/Subforms/GGWE.cs | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pkNX.WinForms/MainEditor/EditorGG.cs b/pkNX.WinForms/MainEditor/EditorGG.cs index 5ddfc0f6..bb184343 100644 --- a/pkNX.WinForms/MainEditor/EditorGG.cs +++ b/pkNX.WinForms/MainEditor/EditorGG.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Linq; +using System.Windows.Forms; using pkNX.Containers; using pkNX.Game; using pkNX.Randomization; @@ -204,9 +205,7 @@ private void PopWildEdit(string file) var obj = FlatBufferConverter.DeserializeFrom(winner); using var form = new GGWE(ROM, obj); - form.ShowDialog(); - var result = form.Result; - if (string.IsNullOrWhiteSpace(result)) + if (form.ShowDialog() != DialogResult.OK) return; var data = FlatBufferConverter.SerializeFrom(obj); diff --git a/pkNX.WinForms/Subforms/GGWE.cs b/pkNX.WinForms/Subforms/GGWE.cs index 3c19748d..2a164228 100644 --- a/pkNX.WinForms/Subforms/GGWE.cs +++ b/pkNX.WinForms/Subforms/GGWE.cs @@ -279,8 +279,6 @@ private void SaveEntry(int i) EL_Sky.SaveCurrent(); } - public string Result { get; set; } - private void B_Save_Click(object sender, EventArgs e) { SaveEntry(entry); @@ -291,7 +289,7 @@ private void B_Save_Click(object sender, EventArgs e) EL_Super.SaveCurrent(); EL_Sky.SaveCurrent(); - Result = "OK"; + DialogResult = DialogResult.OK; Close(); }