Load translations before design file, in case there is an error

Branch_2.1.x
Nathan Crawford 2016-02-23 23:40:21 -05:00
rodzic 246194c2aa
commit 5cf44ec832
1 zmienionych plików z 11 dodań i 3 usunięć

Wyświetl plik

@ -82,14 +82,20 @@ namespace embroideryReader
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
{ {
checkSettings(); // Set app window title
this.Text = APP_TITLE; this.Text = APP_TITLE;
// Load and check settings
checkSettings();
// Load translation
loadTranslatedStrings(settings.translation);
// Load design, if specified
if (args.Length > 1) if (args.Length > 1)
{ {
openFile(args[1]); openFile(args[1]);
} }
loadTranslatedStrings(settings.translation);
} }
// Override WndProc to capture maximize and restore events // Override WndProc to capture maximize and restore events
@ -274,6 +280,7 @@ namespace embroideryReader
{ {
if (!System.IO.File.Exists(filename)) if (!System.IO.File.Exists(filename))
{ {
MessageBox.Show("File \"" + filename + "\" does not exist", "File not found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return; return;
} }
design = new PesFile.PesFile(filename); design = new PesFile.PesFile(filename);
@ -309,6 +316,7 @@ namespace embroideryReader
else else
{ {
string message = translation.GetTranslatedString(Translation.StringID.ERROR_FILE) + // "An error occured while reading the file:" string message = translation.GetTranslatedString(Translation.StringID.ERROR_FILE) + // "An error occured while reading the file:"
Environment.NewLine + design.GetFileName() +
Environment.NewLine + design.getLastError(); Environment.NewLine + design.getLastError();
if (design.getStatus() == PesFile.statusEnum.ParseError) if (design.getStatus() == PesFile.statusEnum.ParseError)
{ {