diff --git a/ParksideView/Language.cs b/ParksideView/Language.cs new file mode 100644 index 0000000..e72b1ef --- /dev/null +++ b/ParksideView/Language.cs @@ -0,0 +1,116 @@ +// Set the language to German (undefine to keep it at English) +// This can also be done through the VS compile options +#if !EXTOPT + #define GERMAN +#endif + +namespace ParksideView +{ + /// + /// Holds the entire UI translation for the language selected at compile time. + /// + internal static class Language + { +#if GERMAN // Compile with German strings + public const string ConnectionHeading = "Verbindung"; + public const string PortLabel = "Port:"; + public const string RefreshButton = "Aktualisieren"; + public const string StartButton = "Start"; + public const string PauseButton = "Pause"; + public const string StopButton = "Stop"; + public const string RecordButton = "Aufzeichnen"; + public const string SaveButton = "Speichern"; + public const string ContinueButton = "Weiter"; + public const string AcquisitionHeading = "Datenerfassung"; + public const string Interval = "Intervall: 500ms *"; + public const string CSVFormatHeading = "CSV-Format"; + public const string WindowHeading = "Fenster"; + public const string TopMostCheckBox = "Deckend"; + public const string MinimizeButton = "Minimieren"; + public const string AcqStatusRecording = " Aufzeichnung ({0} seit {1:00}h {2:00}m {3:00}s)."; + public const string AcqStatusPrefix = "Status: "; + public const string AcqStatusRunning = "Laufend."; + public const string AcqStatusPaused = "Pausiert."; + public const string AcqStatusSilent = "Stumm."; + public const string AcqStatusConnected = "Verbunden."; + public const string AcqStatusDisconnected = "Nicht verbunden."; + public const string SavingFailedText = "Speichern fehlgeschlagen!\nBitte versuchen Sie es erneut!"; + public const string SavingFailedTitle = "Speichern fehlgeschlagen"; + public const string DiscardDataText = "Möchten Sie wirklich die {0} aufgezeichneten Datenpunkte ungespeichert verwerfen?"; + public const string DiscardDataTitle = "Daten verwerfen"; + public const string CSVVersionFormat = "{0} {1} von Benedikt Muessig"; + public const string CSVUnit = "Einheit"; + public const string CSVValue = "Wert"; + public const string CSVDelta = "Zeitdifferenz (s)"; + public const string CSVInterval = "Intervall (s)"; + public const string CSVTime = "Uhrzeit"; + public const string CSVDate = "Datum"; + public const string CSVSoftware = "Software"; + public const string CSVModel = "Modell"; + public const string ConnectionErrorText = "Port {0} konnte nicht geöffnet werden!\n\nFehler: {1}"; + public const string ConnectionErrorTitle = "Verbindungsfehler"; + public const string PortsListErrorText = "Abrufen der Portliste fehlgeschlagen!\nDas Programm wird beendet.\n\nFehler: {0}"; + public const string PortsListErrorTitle = "Kritischer Fehler"; + public const string CopyValueText = "Wert \"{0}\" in die Zwischenablage kopieren?"; + public const string CopyValueTitle = "Wert kopieren"; + public const string ModeUnknown = "Unbekannter Modus"; + public const string ModeSquarewave = "Rechtecksignal"; + public const string ModeVoltageDC = "Spannung (DC)"; + public const string ModeVoltageAC = "Spannung (AC)"; + public const string ModeResistance = "Widerstand"; + public const string ModeDiode = "Diode"; + public const string ModeContinuity = "Kontinuität"; + public const string ModeCurrent = "Strom"; +#else // Fallback to English strings + public const string ConnectionHeading = "Connection"; + public const string PortLabel = "Port:"; + public const string RefreshButton = "Refresh"; + public const string StartButton = "Start"; + public const string PauseButton = "Pause"; + public const string StopButton = "Stop"; + public const string RecordButton = "Record"; + public const string SaveButton = "Save"; + public const string ContinueButton = "Continue"; + public const string AcquisitionHeading = "Acquisition"; + public const string Interval = "Interval: 500ms *"; + public const string CSVFormatHeading = "CSV format"; + public const string WindowHeading = "Window"; + public const string TopMostCheckBox = "Top most"; + public const string MinimizeButton = "Minimize"; + public const string AcqStatusRecording = " Recording ({0} since {1:00}h {2:00}m {3:00}s)."; + public const string AcqStatusPrefix = "Status: "; + public const string AcqStatusRunning = "Running."; + public const string AcqStatusPaused = "Paused."; + public const string AcqStatusSilent = "Silent."; + public const string AcqStatusConnected = "Connected."; + public const string AcqStatusDisconnected = "Not connected."; + public const string SavingFailedText = "Saving failed!\nPlease try again!"; + public const string SavingFailedTitle = "Saving failed"; + public const string DiscardDataText = "Do you really want to discard the {0} unsaved data points?"; + public const string DiscardDataTitle = "Discard data"; + public const string CSVVersionFormat = "{0} {1} by Benedikt Muessig"; + public const string CSVUnit = "Unit"; + public const string CSVValue = "Value"; + public const string CSVDelta = "Time delta (s)"; + public const string CSVInterval = "Interval (s)"; + public const string CSVTime = "Time"; + public const string CSVDate = "Date"; + public const string CSVSoftware = "Software"; + public const string CSVModel = "Model"; + public const string ConnectionErrorText = "Port {0} could not be opened!\n\nError: {1}"; + public const string ConnectionErrorTitle = "Connection error"; + public const string PortsListErrorText = "Could not fetch the ports list.!\nThe program will be terminated.\n\nError: {0}"; + public const string PortsListErrorTitle = "Critical error"; + public const string CopyValueText = "Shall the value \"{0}\" be copied to the clipboard?"; + public const string CopyValueTitle = "Copy value"; + public const string ModeUnknown = "Unknown mode"; + public const string ModeSquarewave = "Square wave"; + public const string ModeVoltageDC = "Voltage (DC)"; + public const string ModeVoltageAC = "Voltage (AC)"; + public const string ModeResistance = "Resistance"; + public const string ModeDiode = "Diode"; + public const string ModeContinuity = "Continuity"; + public const string ModeCurrent = "Current"; +#endif // End of language definition + } +} diff --git a/ParksideView/MainWindow.Designer.cs b/ParksideView/MainWindow.Designer.cs index 70c54d9..7abb431 100644 --- a/ParksideView/MainWindow.Designer.cs +++ b/ParksideView/MainWindow.Designer.cs @@ -36,13 +36,13 @@ private void InitializeComponent() this.modeLabel = new System.Windows.Forms.Label(); this.readoutPanel = new System.Windows.Forms.Panel(); this.recordToggleButton = new System.Windows.Forms.Button(); - this.acquireGroup = new System.Windows.Forms.GroupBox(); - this.acquirePauseButton = new System.Windows.Forms.Button(); + this.acquisitionGroup = new System.Windows.Forms.GroupBox(); + this.acquisitionPauseButton = new System.Windows.Forms.Button(); this.intervalLabel = new System.Windows.Forms.Label(); this.csvFormatGroup = new System.Windows.Forms.GroupBox(); this.csvFormatUSRadio = new System.Windows.Forms.RadioButton(); this.csvFormatDERadio = new System.Windows.Forms.RadioButton(); - this.acquireStatusLabel = new System.Windows.Forms.Label(); + this.acquisitionStatusLabel = new System.Windows.Forms.Label(); this.intervalNumeric = new System.Windows.Forms.NumericUpDown(); this.connectionGroup = new System.Windows.Forms.GroupBox(); this.connectButton = new System.Windows.Forms.Button(); @@ -59,7 +59,7 @@ private void InitializeComponent() this.recordSaveDialog = new System.Windows.Forms.SaveFileDialog(); this.readoutLayout.SuspendLayout(); this.readoutPanel.SuspendLayout(); - this.acquireGroup.SuspendLayout(); + this.acquisitionGroup.SuspendLayout(); this.csvFormatGroup.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.intervalNumeric)).BeginInit(); this.connectionGroup.SuspendLayout(); @@ -146,44 +146,43 @@ private void InitializeComponent() this.recordToggleButton.Name = "recordToggleButton"; this.recordToggleButton.Size = new System.Drawing.Size(101, 22); this.recordToggleButton.TabIndex = 5; - this.recordToggleButton.Text = "Aufzeichnen"; + this.recordToggleButton.Text = ""; this.recordToggleButton.UseVisualStyleBackColor = true; this.recordToggleButton.Click += new System.EventHandler(this.recordToggleButton_Click); // - // acquireGroup - // - this.acquireGroup.Controls.Add(this.acquirePauseButton); - this.acquireGroup.Controls.Add(this.intervalLabel); - this.acquireGroup.Controls.Add(this.csvFormatGroup); - this.acquireGroup.Controls.Add(this.acquireStatusLabel); - this.acquireGroup.Controls.Add(this.intervalNumeric); - this.acquireGroup.Controls.Add(this.recordToggleButton); - this.acquireGroup.Location = new System.Drawing.Point(12, 224); - this.acquireGroup.Name = "acquireGroup"; - this.acquireGroup.Size = new System.Drawing.Size(310, 96); - this.acquireGroup.TabIndex = 4; - this.acquireGroup.TabStop = false; - this.acquireGroup.Text = "Datenerfassung"; - // - // acquirePauseButton - // - this.acquirePauseButton.Location = new System.Drawing.Point(116, 18); - this.acquirePauseButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.acquirePauseButton.Name = "acquirePauseButton"; - this.acquirePauseButton.Size = new System.Drawing.Size(64, 22); - this.acquirePauseButton.TabIndex = 6; - this.acquirePauseButton.Text = "Pause"; - this.acquirePauseButton.UseVisualStyleBackColor = true; - this.acquirePauseButton.Click += new System.EventHandler(this.acquirePauseButton_Click); + // acquisitionGroup + // + this.acquisitionGroup.Controls.Add(this.acquisitionPauseButton); + this.acquisitionGroup.Controls.Add(this.intervalLabel); + this.acquisitionGroup.Controls.Add(this.csvFormatGroup); + this.acquisitionGroup.Controls.Add(this.acquisitionStatusLabel); + this.acquisitionGroup.Controls.Add(this.intervalNumeric); + this.acquisitionGroup.Controls.Add(this.recordToggleButton); + this.acquisitionGroup.Location = new System.Drawing.Point(12, 224); + this.acquisitionGroup.Name = "acquisitionGroup"; + this.acquisitionGroup.Size = new System.Drawing.Size(310, 96); + this.acquisitionGroup.TabIndex = 4; + this.acquisitionGroup.TabStop = false; + this.acquisitionGroup.Text = ""; + // + // acquisitionPauseButton + // + this.acquisitionPauseButton.Location = new System.Drawing.Point(116, 18); + this.acquisitionPauseButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.acquisitionPauseButton.Name = "acquisitionPauseButton"; + this.acquisitionPauseButton.Size = new System.Drawing.Size(64, 22); + this.acquisitionPauseButton.TabIndex = 6; + this.acquisitionPauseButton.Text = "

"; + this.acquisitionPauseButton.UseVisualStyleBackColor = true; + this.acquisitionPauseButton.Click += new System.EventHandler(this.acquisitionPauseButton_Click); // // intervalLabel // - this.intervalLabel.AutoSize = true; this.intervalLabel.Location = new System.Drawing.Point(7, 50); this.intervalLabel.Name = "intervalLabel"; this.intervalLabel.Size = new System.Drawing.Size(94, 13); this.intervalLabel.TabIndex = 10; - this.intervalLabel.Text = "Intervall: 500ms *"; + this.intervalLabel.Text = ""; // // csvFormatGroup // @@ -194,7 +193,7 @@ private void InitializeComponent() this.csvFormatGroup.Size = new System.Drawing.Size(107, 60); this.csvFormatGroup.TabIndex = 8; this.csvFormatGroup.TabStop = false; - this.csvFormatGroup.Text = "CSV-Format"; + this.csvFormatGroup.Text = ""; // // csvFormatUSRadio // @@ -218,14 +217,13 @@ private void InitializeComponent() this.csvFormatDERadio.Text = "DE: 0,12; 0,23"; this.csvFormatDERadio.UseVisualStyleBackColor = true; // - // acquireStatusLabel + // acquisitionStatusLabel // - this.acquireStatusLabel.AutoSize = true; - this.acquireStatusLabel.Location = new System.Drawing.Point(6, 76); - this.acquireStatusLabel.Name = "acquireStatusLabel"; - this.acquireStatusLabel.Size = new System.Drawing.Size(266, 13); - this.acquireStatusLabel.TabIndex = 5; - this.acquireStatusLabel.Text = "Status: Pausiert. Aufzeichnung ({0} seit 1h 25m 13s)"; + this.acquisitionStatusLabel.Location = new System.Drawing.Point(6, 76); + this.acquisitionStatusLabel.Name = "acquisitionStatusLabel"; + this.acquisitionStatusLabel.Size = new System.Drawing.Size(292, 13); + this.acquisitionStatusLabel.TabIndex = 5; + this.acquisitionStatusLabel.Text = ""; // // intervalNumeric // @@ -264,7 +262,7 @@ private void InitializeComponent() this.connectionGroup.Size = new System.Drawing.Size(199, 69); this.connectionGroup.TabIndex = 0; this.connectionGroup.TabStop = false; - this.connectionGroup.Text = "Verbindung"; + this.connectionGroup.Text = ""; // // connectButton // @@ -272,18 +270,17 @@ private void InitializeComponent() this.connectButton.Name = "connectButton"; this.connectButton.Size = new System.Drawing.Size(45, 23); this.connectButton.TabIndex = 3; - this.connectButton.Text = "Start"; + this.connectButton.Text = ""; this.connectButton.UseVisualStyleBackColor = true; this.connectButton.Click += new System.EventHandler(this.connectButton_Click); // // connectionStatusLabel // - this.connectionStatusLabel.AutoSize = true; this.connectionStatusLabel.Location = new System.Drawing.Point(6, 45); this.connectionStatusLabel.Name = "connectionStatusLabel"; - this.connectionStatusLabel.Size = new System.Drawing.Size(103, 13); + this.connectionStatusLabel.Size = new System.Drawing.Size(135, 13); this.connectionStatusLabel.TabIndex = 3; - this.connectionStatusLabel.Text = "Status: Verbunden"; + this.connectionStatusLabel.Text = ""; // // refreshPortsButton // @@ -292,18 +289,17 @@ private void InitializeComponent() this.refreshPortsButton.Name = "refreshPortsButton"; this.refreshPortsButton.Size = new System.Drawing.Size(45, 23); this.refreshPortsButton.TabIndex = 2; - this.refreshPortsButton.Text = "Aktualisieren"; + this.refreshPortsButton.Text = ""; this.refreshPortsButton.UseVisualStyleBackColor = true; this.refreshPortsButton.Click += new System.EventHandler(this.refreshPortsButton_Click); // // portLabel // - this.portLabel.AutoSize = true; this.portLabel.Location = new System.Drawing.Point(6, 20); this.portLabel.Name = "portLabel"; this.portLabel.Size = new System.Drawing.Size(31, 13); this.portLabel.TabIndex = 1; - this.portLabel.Text = "Port:"; + this.portLabel.Text = ""; // // portsListBox // @@ -323,7 +319,7 @@ private void InitializeComponent() this.windowGroup.Size = new System.Drawing.Size(103, 69); this.windowGroup.TabIndex = 11; this.windowGroup.TabStop = false; - this.windowGroup.Text = "Fenster"; + this.windowGroup.Text = ""; // // minimizeButton // @@ -331,7 +327,7 @@ private void InitializeComponent() this.minimizeButton.Name = "minimizeButton"; this.minimizeButton.Size = new System.Drawing.Size(87, 23); this.minimizeButton.TabIndex = 13; - this.minimizeButton.Text = "Minimieren"; + this.minimizeButton.Text = ""; this.minimizeButton.UseVisualStyleBackColor = true; this.minimizeButton.Click += new System.EventHandler(this.minimizeButton_Click); // @@ -340,9 +336,9 @@ private void InitializeComponent() this.topMostCheck.AutoSize = true; this.topMostCheck.Location = new System.Drawing.Point(11, 18); this.topMostCheck.Name = "topMostCheck"; - this.topMostCheck.Size = new System.Drawing.Size(71, 17); + this.topMostCheck.Size = new System.Drawing.Size(89, 17); this.topMostCheck.TabIndex = 12; - this.topMostCheck.Text = "Deckend"; + this.topMostCheck.Text = ""; this.topMostCheck.UseVisualStyleBackColor = true; this.topMostCheck.CheckedChanged += new System.EventHandler(this.topMostCheck_CheckedChanged); // @@ -388,7 +384,7 @@ private void InitializeComponent() this.Controls.Add(this.copyrightLabel); this.Controls.Add(this.windowGroup); this.Controls.Add(this.connectionGroup); - this.Controls.Add(this.acquireGroup); + this.Controls.Add(this.acquisitionGroup); this.Controls.Add(this.readoutPanel); this.DoubleBuffered = true; this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -397,18 +393,16 @@ private void InitializeComponent() this.MaximizeBox = false; this.Name = "MainWindow"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "ParksideView v1.1"; + this.Text = "ParksideView v1.2"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainWindow_FormClosing); this.readoutLayout.ResumeLayout(false); this.readoutLayout.PerformLayout(); this.readoutPanel.ResumeLayout(false); - this.acquireGroup.ResumeLayout(false); - this.acquireGroup.PerformLayout(); + this.acquisitionGroup.ResumeLayout(false); this.csvFormatGroup.ResumeLayout(false); this.csvFormatGroup.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.intervalNumeric)).EndInit(); this.connectionGroup.ResumeLayout(false); - this.connectionGroup.PerformLayout(); this.windowGroup.ResumeLayout(false); this.windowGroup.PerformLayout(); this.ResumeLayout(false); @@ -423,8 +417,8 @@ private void InitializeComponent() private System.Windows.Forms.Label modeLabel; private System.Windows.Forms.Panel readoutPanel; private System.Windows.Forms.Button recordToggleButton; - private System.Windows.Forms.GroupBox acquireGroup; - private System.Windows.Forms.Label acquireStatusLabel; + private System.Windows.Forms.GroupBox acquisitionGroup; + private System.Windows.Forms.Label acquisitionStatusLabel; private System.Windows.Forms.NumericUpDown intervalNumeric; private System.Windows.Forms.GroupBox connectionGroup; private System.Windows.Forms.Label intervalLabel; @@ -439,7 +433,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox topMostCheck; private System.Windows.Forms.Label copyrightLabel; private System.Windows.Forms.Button minimizeButton; - private System.Windows.Forms.Button acquirePauseButton; + private System.Windows.Forms.Button acquisitionPauseButton; private System.Windows.Forms.Button connectButton; private System.Windows.Forms.Timer acquireTimer; private System.Windows.Forms.ProgressBar bargraphBar; diff --git a/ParksideView/MainWindow.cs b/ParksideView/MainWindow.cs index d9efcad..23543a4 100644 --- a/ParksideView/MainWindow.cs +++ b/ParksideView/MainWindow.cs @@ -8,7 +8,7 @@ namespace ParksideView { - public partial class MainWindow : Form + internal partial class MainWindow : Form { private bool isConnected = false, isPaused = false, isRecording = false, isTimerUpdatePending = false, isAlive = true; private StringBuilder recordingBuffer = new StringBuilder(); @@ -21,10 +21,25 @@ public MainWindow() // Initialize the controls InitializeComponent(); + // Translate the static parts of the UI + // Connection group + connectionGroup.Text = Language.ConnectionHeading; + portLabel.Text = Language.PortLabel; + refreshPortsButton.Text = Language.RefreshButton; + // Window group + windowGroup.Text = Language.WindowHeading; + topMostCheck.Text = Language.TopMostCheckBox; + minimizeButton.Text = Language.MinimizeButton; + // Acquisition group + acquisitionGroup.Text = Language.AcquisitionHeading; + intervalLabel.Text = Language.Interval; + // CSV group + csvFormatGroup.Text = Language.CSVFormatHeading; + // Refresh the ports list RefreshPorts(); - // Setup the UI + // Setup the UI (handles translation of the dynamic parts) ChangeUI(false, false, false); UpdateTimer(); } @@ -137,44 +152,44 @@ private void acquireTimer_Tick(object sender, EventArgs e) switch (sample.Mode) { case Mode.Ampere: - modeLabel.Text = "Strom"; + modeLabel.Text = Language.ModeCurrent; break; case Mode.AmpereMicro: - modeLabel.Text = "Strom"; + modeLabel.Text = Language.ModeCurrent; break; case Mode.AmpereMilli: - modeLabel.Text = "Strom"; + modeLabel.Text = Language.ModeCurrent; break; case Mode.ContinuityOhm: - modeLabel.Text = "Kontinuität"; + modeLabel.Text = Language.ModeContinuity; break; case Mode.DiodeVolt: - modeLabel.Text = "Diode"; + modeLabel.Text = Language.ModeDiode; break; case Mode.ResistanceOhm: - modeLabel.Text = "Widerstand"; + modeLabel.Text = Language.ModeResistance; break; case Mode.VoltAC: - modeLabel.Text = "Spannung (AC)"; + modeLabel.Text = Language.ModeVoltageAC; break; case Mode.VoltDC: - modeLabel.Text = "Spannung (DC)"; + modeLabel.Text = Language.ModeVoltageDC; break; case Mode.Squarewave: - modeLabel.Text = "Rechtecksignal"; + modeLabel.Text = Language.ModeSquarewave; valueMode = false; break; default: - modeLabel.Text = "Unbekannter Modus!"; + modeLabel.Text = Language.ModeUnknown; valueMode = false; validMode = false; break; @@ -296,7 +311,7 @@ private void connectButton_Click(object sender, EventArgs e) Connect(portName); } - private void acquirePauseButton_Click(object sender, EventArgs e) + private void acquisitionPauseButton_Click(object sender, EventArgs e) { // Toggle the acquisition state if (isPaused) @@ -378,8 +393,8 @@ private void CopyValue() return; // Ask the user about copying the value into the clipboard - if (MessageBox.Show(string.Format("Wert \"{0}\" in die Zwischenablage kopieren?", value), - "Wert kopieren", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) + if (MessageBox.Show(string.Format(Language.CopyValueText, value), + Language.CopyValueTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) Clipboard.SetText(value); } @@ -411,11 +426,8 @@ private void RefreshPorts() catch (Exception ex) { // If there was any error, exit, as there is no recovery from this - MessageBox.Show(string.Format( - "Abrufen der Portliste fehlgeschlagen!\nDas Programm wird beendet.\n\nFehler: {0}", ex.Message), - "Kritischer Fehler!", - MessageBoxButtons.OK, - MessageBoxIcon.Error); + MessageBox.Show(string.Format(Language.PortsListErrorText, ex.Message), + Language.PortsListErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } } @@ -442,11 +454,8 @@ private void Connect(string portName) if (error != null) { // If there was any error, exit, as there is no recovery from this - MessageBox.Show(string.Format( - "Port {0} konnte nicht geöffnet werden!\n\nFehler: {1}", portName, error.Message), - "Fehler!", - MessageBoxButtons.OK, - MessageBoxIcon.Exclamation); + MessageBox.Show(string.Format(Language.ConnectionErrorText, portName, error.Message), + Language.ConnectionErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); ChangeUI(false); return; } @@ -514,35 +523,35 @@ private void StartRecording() recordingStart = DateTime.Now; // Write the model - recordingBuffer.Append("Model"); + recordingBuffer.Append(Language.CSVModel); recordingBuffer.Append(GetCSVDelimiter()); - recordingBuffer.Append("Parkside PDM300 C2"); + recordingBuffer.Append("Parkside PDM-300-C2"); recordingBuffer.Append(GetCSVDelimiter()); recordingBuffer.AppendLine(); // Write the version - recordingBuffer.Append("Software"); + recordingBuffer.Append(Language.CSVSoftware); recordingBuffer.Append(GetCSVDelimiter()); - recordingBuffer.AppendFormat("{0} {1} by Benedikt Muessig", Application.ProductName, Application.ProductVersion); + recordingBuffer.AppendFormat(Language.CSVVersionFormat, Application.ProductName, Application.ProductVersion); recordingBuffer.Append(GetCSVDelimiter()); recordingBuffer.AppendLine(); // Write the date - recordingBuffer.Append("Datum"); + recordingBuffer.Append(Language.CSVDate); recordingBuffer.Append(GetCSVDelimiter()); recordingBuffer.AppendFormat("{0:00}.{1:00}.{2:0000}", recordingStart.Day, recordingStart.Month, recordingStart.Year); recordingBuffer.Append(GetCSVDelimiter()); recordingBuffer.AppendLine(); // Write the time - recordingBuffer.Append("Uhrzeit"); + recordingBuffer.Append(Language.CSVTime); recordingBuffer.Append(GetCSVDelimiter()); recordingBuffer.AppendFormat("{0:00}:{1:00}:{2:00}:{3:000}", recordingStart.Hour, recordingStart.Minute, recordingStart.Second, recordingStart.Millisecond); recordingBuffer.Append(GetCSVDelimiter()); recordingBuffer.AppendLine(); - recordingBuffer.Append("Intervall (s)"); + recordingBuffer.Append(Language.CSVInterval); recordingBuffer.Append(GetCSVDelimiter()); recordingBuffer.AppendFormat(new NumberFormatInfo() { NumberDecimalSeparator = GetCSVFractionalSeparator().ToString(), NumberDecimalDigits = 2 }, "{0:E}", acquireTimer.Interval / 1000d); @@ -551,11 +560,11 @@ private void StartRecording() recordingBuffer.AppendLine(); // Write the CSV header (3 columns) - recordingBuffer.Append("Zeitdifferenz (s)"); + recordingBuffer.Append(Language.CSVDelta); recordingBuffer.Append(GetCSVDelimiter()); - recordingBuffer.Append("Wert"); + recordingBuffer.Append(Language.CSVValue); recordingBuffer.Append(GetCSVDelimiter()); - recordingBuffer.Append("Einheit"); + recordingBuffer.Append(Language.CSVUnit); recordingBuffer.AppendLine(); // Update the UI @@ -592,8 +601,8 @@ private void SaveRecording() while (true) { while (recordSaveDialog.ShowDialog() != DialogResult.OK) - if (MessageBox.Show(string.Format("Möchten Sie wirklich die {0} aufgezeichneten Datenpunkte ungespeichert verwerfen?", recordingCount), - "Daten verwerfen", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) + if (MessageBox.Show(string.Format(Language.DiscardDataText, recordingCount), Language.DiscardDataTitle, + MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) return; // Save the data @@ -606,8 +615,7 @@ private void SaveRecording() } catch (Exception) { - MessageBox.Show("Speichern fehlgeschlagen!\nBitte versuchen Sie es erneut!", "Speichern fehlgeschlagen", - MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + MessageBox.Show(Language.SavingFailedText, Language.SavingFailedTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } @@ -644,11 +652,11 @@ private void ChangeUI(bool isConnected, bool isPaused, bool isRecording) // Decide what to do with the UI refreshPortsButton.Enabled = !isConnected; portsListBox.Enabled = !isConnected; - connectButton.Text = isConnected ? "Stop" : "Start"; - recordToggleButton.Text = (isRecording && isConnected) ? "Speichern" : "Aufzeichnen"; - acquirePauseButton.Text = (isPaused && isConnected) ? "Weiter" : "Pause"; + connectButton.Text = isConnected ? Language.StopButton : Language.StartButton; + recordToggleButton.Text = (isRecording && isConnected) ? Language.SaveButton : Language.RecordButton; + acquisitionPauseButton.Text = (isPaused && isConnected) ? Language.ContinueButton : Language.PauseButton; recordToggleButton.Enabled = isConnected; - acquirePauseButton.Enabled = isConnected; + acquisitionPauseButton.Enabled = isConnected; csvFormatGroup.Enabled = isConnected && !isRecording; intervalNumeric.Enabled = !isRecording; @@ -668,17 +676,17 @@ private void UpdateStatusLabels() // Handle idle if (!isConnected) { - connectionStatusLabel.Text = "Status: Nicht verbunden."; - acquireStatusLabel.Text = connectionStatusLabel.Text; + connectionStatusLabel.Text = Language.AcqStatusPrefix + Language.AcqStatusDisconnected; + acquisitionStatusLabel.Text = connectionStatusLabel.Text; return; } // Always set the connected label - connectionStatusLabel.Text = "Status: Verbunden."; + connectionStatusLabel.Text = Language.AcqStatusPrefix + Language.AcqStatusConnected; // Assemble the acquire status text - StringBuilder statusBuilder = new StringBuilder("Status: "); - statusBuilder.Append(isAlive ? (isPaused ? "Pausiert." : "Laufend.") : "Stumm."); + StringBuilder statusBuilder = new StringBuilder(Language.AcqStatusPrefix); + statusBuilder.Append(isAlive ? (isPaused ? Language.AcqStatusPaused : Language.AcqStatusRunning) : Language.AcqStatusSilent); if (isRecording) { // Calculate the time that has passed @@ -686,11 +694,11 @@ private void UpdateStatusLabels() int seconds = recordingSpan.Seconds, minutes = recordingSpan.Minutes, hours = recordingSpan.Hours + recordingSpan.Days * 24; // Update the builder - statusBuilder.AppendFormat(" Aufzeichnung ({0} seit {1:00}h {2:00}m {3:00}s).", recordingCount, hours, minutes, seconds); + statusBuilder.AppendFormat(Language.AcqStatusRecording, recordingCount, hours, minutes, seconds); } // Apply the label - acquireStatusLabel.Text = string.Copy(statusBuilder.ToString()); + acquisitionStatusLabel.Text = string.Copy(statusBuilder.ToString()); statusBuilder.Clear(); } diff --git a/ParksideView/ParksideView.csproj b/ParksideView/ParksideView.csproj index 78aee91..9b887a4 100644 --- a/ParksideView/ParksideView.csproj +++ b/ParksideView/ParksideView.csproj @@ -25,11 +25,11 @@ 4 - x86 + AnyCPU pdbonly true bin\Release\ - TRACE + TRACE;EXTOPT GERMAN prompt 4 @@ -49,6 +49,7 @@ + Form diff --git a/ParksideView/Program.cs b/ParksideView/Program.cs index 144e077..d8224e9 100644 --- a/ParksideView/Program.cs +++ b/ParksideView/Program.cs @@ -3,7 +3,7 @@ namespace ParksideView { - static class Program + internal static class Program { ///

/// Application entry point. diff --git a/ParksideView/Properties/AssemblyInfo.cs b/ParksideView/Properties/AssemblyInfo.cs index 528e537..d566491 100644 --- a/ParksideView/Properties/AssemblyInfo.cs +++ b/ParksideView/Properties/AssemblyInfo.cs @@ -33,6 +33,6 @@ // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] [assembly: NeutralResourcesLanguageAttribute("de-DE")]