diff --git a/EduNetworkBuilder/TranslationWindow.cs b/EduNetworkBuilder/TranslationWindow.cs index 654220b..62924d2 100644 --- a/EduNetworkBuilder/TranslationWindow.cs +++ b/EduNetworkBuilder/TranslationWindow.cs @@ -27,6 +27,7 @@ namespace EduNetworkBuilder List FormData = new List(); string EnglishTargetFile = "edustrings.resx"; bool ChangedFormData = false; + bool ChangedPuzzleData = false; ToolTip myTooltip = new ToolTip(); @@ -180,7 +181,7 @@ namespace EduNetworkBuilder private void Save() { - if (File.Exists(myNet.NetworkFilename)) + if (ChangedPuzzleData && File.Exists(myNet.NetworkFilename)) { myNet.Save(); //Console.WriteLine("Saved"); @@ -206,6 +207,17 @@ namespace EduNetworkBuilder private void TranslationWindow_FormClosing(object sender, FormClosingEventArgs e) { + if(ChangedFormData || ChangedPuzzleData) + { + DialogResult answer = MessageBox.Show("Save?", "Save?", MessageBoxButtons.YesNoCancel); + if(answer == DialogResult.Cancel) + { + e.Cancel = true; + return; + } + if (answer == DialogResult.Yes) + Save(); + } ClosingStuff(); } @@ -243,7 +255,11 @@ namespace EduNetworkBuilder string What = CodeFromLang(cb1Language.Text); if (What != "") { - myNet.NetMessage.ChangeText(What,tb1Message.Text); + if (tb1Message.Text != myNet.NetMessage.GetText(What)) + { + ChangedPuzzleData = true; + myNet.NetMessage.ChangeText(What, tb1Message.Text); + } } RefreshContents(); } @@ -253,7 +269,11 @@ namespace EduNetworkBuilder string What = CodeFromLang(cb2Language.Text); if (What != "") { - myNet.NetMessage.ChangeText(What, tb2Message.Text); + if (tb2Message.Text != myNet.NetMessage.GetText(What)) + { + ChangedPuzzleData = true; + myNet.NetMessage.ChangeText(What, tb2Message.Text); + } } RefreshContents(); } @@ -305,7 +325,7 @@ namespace EduNetworkBuilder - + #region Form Translation Stuff //**********************************************************************// //******************* Form Translation Things **************************// //**********************************************************************// @@ -554,6 +574,7 @@ namespace EduNetworkBuilder myTooltip.SetToolTip(cbFormFilter,tooltip); } } + #endregion #region TranslationClasses public class TranslationItem