private void loadTranslatedStrings(String translationName) { translation = new Translation(translationName); // File menu fileToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_FILE); openToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_OPEN); saveAsBitmapToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_SAVE_IMAGE); printToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_PRINT); printPreviewToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_PRINT_PREVIEW); exitToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_EXIT); // Edit menu editToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_EDIT); copyToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_COPY); preferencesToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_PREFS); // View menu viewToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_VIEW); rotateLeftToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.ROTATE_LEFT); rotateRightToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.ROTATE_RIGHT); refreshToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_RESET); zoomToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_SCALE_ZOOM); fitToWindowToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_FIT_TO_WINDOW); // Help menu helpToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_HELP); checkForUpdateToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.CHECK_UPDATE); saveDebugInfoToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.SAVE_DEBUG); showDebugInfoToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.SHOW_DEBUG); aboutToolStripMenuItem.Text = translation.GetTranslatedString(Translation.StringID.MENU_ABOUT); }
private void openFile(string filename) { if (!System.IO.File.Exists(filename)) { return; } design = new PesFile.PesFile(filename); loadedFileName = filename; if (design.getStatus() == PesFile.statusEnum.Ready) { updateDesignImage(); if (design.getFormatWarning()) { toolStripStatusLabel1.Text = translation.GetTranslatedString(Translation.StringID.UNSUPPORTED_FORMAT); // "The format of this file is not completely supported"; } else if (design.getColorWarning()) { toolStripStatusLabel1.Text = translation.GetTranslatedString(Translation.StringID.COLOR_WARNING); // "Colors shown for this design may be inaccurate" } else { toolStripStatusLabel1.Text = ""; } copyToolStripMenuItem.Enabled = true; saveDebugInfoToolStripMenuItem.Enabled = true; printPreviewToolStripMenuItem.Enabled = true; printToolStripMenuItem.Enabled = true; rotateLeftToolStripMenuItem.Enabled = true; rotateRightToolStripMenuItem.Enabled = true; refreshToolStripMenuItem.Enabled = true; zoomToolStripMenuItem.Enabled = true; showDebugInfoToolStripMenuItem.Enabled = true; saveAsBitmapToolStripMenuItem.Enabled = true; panel2.Select(); } else { string message = translation.GetTranslatedString(Translation.StringID.ERROR_FILE) + // "An error occured while reading the file:" Environment.NewLine + design.getLastError(); if (design.getStatus() == PesFile.statusEnum.ParseError) { message += Environment.NewLine + translation.GetTranslatedString(Translation.StringID.CORRUPT_FILE); // "This file is either corrupt or not a valid PES file." } MessageBox.Show(message); copyToolStripMenuItem.Enabled = false; saveDebugInfoToolStripMenuItem.Enabled = false; printPreviewToolStripMenuItem.Enabled = false; printToolStripMenuItem.Enabled = false; rotateLeftToolStripMenuItem.Enabled = false; rotateRightToolStripMenuItem.Enabled = false; refreshToolStripMenuItem.Enabled = false; showDebugInfoToolStripMenuItem.Enabled = false; saveAsBitmapToolStripMenuItem.Enabled = false; } }
private void OpenFile(string filename) { if (!System.IO.File.Exists(filename)) { // "An error occured while reading the file:" MessageBox.Show(Translation.StringID.ERROR_FILE + Environment.NewLine + "File \"" + filename + "\" does not exist", "File not found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } try { design = new PesFile.PesFile(filename); } catch (System.IO.IOException ioex) { // "An error occured while reading the file:" MessageBox.Show(Translation.StringID.ERROR_FILE + Environment.NewLine + filename + ":" + Environment.NewLine + ioex.Message, "IOException", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); design = null; } catch (PesFile.PECFormatException pecex) { // "This file is either corrupt or not a valid PES file." MessageBox.Show(Translation.StringID.ERROR_FILE + Environment.NewLine + filename + ":" + Environment.NewLine + pecex.Message, "PECFormatException", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); design = null; } loadedFileName = filename; if (design != null) { UpdateDesignImage(); if (design.GetFormatWarning()) { toolStripStatusLabel1.Text = translation.GetTranslatedString(Translation.StringID.UNSUPPORTED_FORMAT); // "The format of this file is not completely supported"; } else if (design.GetColorWarning()) { toolStripStatusLabel1.Text = translation.GetTranslatedString(Translation.StringID.COLOR_WARNING); // "Colors shown for this design may be inaccurate" } else { toolStripStatusLabel1.Text = ""; } copyToolStripMenuItem.Enabled = true; saveDebugInfoToolStripMenuItem.Enabled = true; printPreviewToolStripMenuItem.Enabled = true; printToolStripMenuItem.Enabled = true; rotateLeftToolStripMenuItem.Enabled = true; rotateRightToolStripMenuItem.Enabled = true; refreshToolStripMenuItem.Enabled = true; zoomToolStripMenuItem.Enabled = true; showDebugInfoToolStripMenuItem.Enabled = true; saveAsBitmapToolStripMenuItem.Enabled = true; panel2.Select(); } else { copyToolStripMenuItem.Enabled = false; saveDebugInfoToolStripMenuItem.Enabled = false; printPreviewToolStripMenuItem.Enabled = false; printToolStripMenuItem.Enabled = false; rotateLeftToolStripMenuItem.Enabled = false; rotateRightToolStripMenuItem.Enabled = false; refreshToolStripMenuItem.Enabled = false; showDebugInfoToolStripMenuItem.Enabled = false; saveAsBitmapToolStripMenuItem.Enabled = false; } }
private void loadTranslatedStrings() { this.Text = translation.GetTranslatedString(Translation.StringID.SETTINGS); grpBackground.Text = translation.GetTranslatedString(Translation.StringID.BACKGROUND); lblBackgroundColor.Text = translation.GetTranslatedString(Translation.StringID.BACKGROUND_COLOR); btnColor.Text = translation.GetTranslatedString(Translation.StringID.PICK_COLOR); btnResetColor.Text = translation.GetTranslatedString(Translation.StringID.RESET_COLOR); grpStitch.Text = translation.GetTranslatedString(Translation.StringID.STITCH_DRAW); lblThreadThickness.Text = translation.GetTranslatedString(Translation.StringID.THREAD_THICKNESS); txtThreadThickness.Left = lblThreadThickness.Right + 5; lblPixelThick.Text = translation.GetTranslatedString(Translation.StringID.PIXELS); lblPixelThick.Left = txtThreadThickness.Right + 5; chkUglyStitches.Text = translation.GetTranslatedString(Translation.StringID.REMOVE_UGLY_STITCHES); lblUglyLength.Text = translation.GetTranslatedString(Translation.StringID.UGLY_STITCH_LENGTH); txtThreshold.Left = lblUglyLength.Right + 5; lblPixelLength.Text = translation.GetTranslatedString(Translation.StringID.PIXELS); lblPixelLength.Left = txtThreshold.Right + 5; chkDrawGrid.Text = translation.GetTranslatedString(Translation.StringID.ENABLE_TRANSPARENCY_GRID); grpLanguage.Text = translation.GetTranslatedString(Translation.StringID.LANGUAGE); btnCancel.Text = translation.GetTranslatedString(Translation.StringID.CANCEL); btnOK.Text = translation.GetTranslatedString(Translation.StringID.OK); btnGridColor.Text = translation.GetTranslatedString(Translation.StringID.PICK_COLOR); btnResetGridColor.Text = translation.GetTranslatedString(Translation.StringID.RESET_COLOR); lblGridSize.Text = translation.GetTranslatedString(Translation.StringID.GRID_SIZE); txtGridSize.Left = lblGridSize.Right + 5; lblGridSizePixels.Text = translation.GetTranslatedString(Translation.StringID.PIXELS); lblGridSizePixels.Left = txtGridSize.Right + 5; lblIncompleteTranslation.Text = translation.GetTranslatedString(Translation.StringID.TRANSLATION_INCOMPLETE); }