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>();
|
List<TranslationFormData> FormData = new List<TranslationFormData>();
|
||||||
string EnglishTargetFile = "edustrings.resx";
|
string EnglishTargetFile = "edustrings.resx";
|
||||||
bool ChangedFormData = false;
|
bool ChangedFormData = false;
|
||||||
|
bool ChangedPuzzleData = false;
|
||||||
ToolTip myTooltip = new ToolTip();
|
ToolTip myTooltip = new ToolTip();
|
||||||
|
|
||||||
|
|
||||||
@ -180,7 +181,7 @@ namespace EduNetworkBuilder
|
|||||||
|
|
||||||
private void Save()
|
private void Save()
|
||||||
{
|
{
|
||||||
if (File.Exists(myNet.NetworkFilename))
|
if (ChangedPuzzleData && File.Exists(myNet.NetworkFilename))
|
||||||
{
|
{
|
||||||
myNet.Save();
|
myNet.Save();
|
||||||
//Console.WriteLine("Saved");
|
//Console.WriteLine("Saved");
|
||||||
@ -206,6 +207,17 @@ namespace EduNetworkBuilder
|
|||||||
|
|
||||||
private void TranslationWindow_FormClosing(object sender, FormClosingEventArgs e)
|
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();
|
ClosingStuff();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +255,11 @@ namespace EduNetworkBuilder
|
|||||||
string What = CodeFromLang(cb1Language.Text);
|
string What = CodeFromLang(cb1Language.Text);
|
||||||
if (What != "")
|
if (What != "")
|
||||||
{
|
{
|
||||||
myNet.NetMessage.ChangeText(What,tb1Message.Text);
|
if (tb1Message.Text != myNet.NetMessage.GetText(What))
|
||||||
|
{
|
||||||
|
ChangedPuzzleData = true;
|
||||||
|
myNet.NetMessage.ChangeText(What, tb1Message.Text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RefreshContents();
|
RefreshContents();
|
||||||
}
|
}
|
||||||
@ -253,7 +269,11 @@ namespace EduNetworkBuilder
|
|||||||
string What = CodeFromLang(cb2Language.Text);
|
string What = CodeFromLang(cb2Language.Text);
|
||||||
if (What != "")
|
if (What != "")
|
||||||
{
|
{
|
||||||
myNet.NetMessage.ChangeText(What, tb2Message.Text);
|
if (tb2Message.Text != myNet.NetMessage.GetText(What))
|
||||||
|
{
|
||||||
|
ChangedPuzzleData = true;
|
||||||
|
myNet.NetMessage.ChangeText(What, tb2Message.Text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RefreshContents();
|
RefreshContents();
|
||||||
}
|
}
|
||||||
@ -305,7 +325,7 @@ namespace EduNetworkBuilder
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region Form Translation Stuff
|
||||||
//**********************************************************************//
|
//**********************************************************************//
|
||||||
//******************* Form Translation Things **************************//
|
//******************* Form Translation Things **************************//
|
||||||
//**********************************************************************//
|
//**********************************************************************//
|
||||||
@ -554,6 +574,7 @@ namespace EduNetworkBuilder
|
|||||||
myTooltip.SetToolTip(cbFormFilter,tooltip);
|
myTooltip.SetToolTip(cbFormFilter,tooltip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region TranslationClasses
|
#region TranslationClasses
|
||||||
public class TranslationItem
|
public class TranslationItem
|
||||||
|
Loading…
Reference in New Issue
Block a user