Prompt to save unsaved changes to translation stuff
This commit is contained in:
parent
4169aeb35e
commit
09c1fcafc3
@ -27,6 +27,7 @@ namespace EduNetworkBuilder
|
||||
List<TranslationFormData> FormData = new List<TranslationFormData>();
|
||||
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,8 +255,12 @@ namespace EduNetworkBuilder
|
||||
string What = CodeFromLang(cb1Language.Text);
|
||||
if (What != "")
|
||||
{
|
||||
if (tb1Message.Text != myNet.NetMessage.GetText(What))
|
||||
{
|
||||
ChangedPuzzleData = true;
|
||||
myNet.NetMessage.ChangeText(What, tb1Message.Text);
|
||||
}
|
||||
}
|
||||
RefreshContents();
|
||||
}
|
||||
|
||||
@ -253,8 +269,12 @@ namespace EduNetworkBuilder
|
||||
string What = CodeFromLang(cb2Language.Text);
|
||||
if (What != "")
|
||||
{
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user