diff --git a/Tidstagning/ConfigUI.Designer.cs b/Tidstagning/ConfigUI.Designer.cs index 97dd621..0cb93f0 100644 --- a/Tidstagning/ConfigUI.Designer.cs +++ b/Tidstagning/ConfigUI.Designer.cs @@ -31,7 +31,7 @@ namespace Tidstagning { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigUI)); this.label1 = new System.Windows.Forms.Label(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.checkBoxRelay = new System.Windows.Forms.CheckBox(); this.folderBrowserOutput = new System.Windows.Forms.FolderBrowserDialog(); this.buttonFolderOutput = new System.Windows.Forms.Button(); this.folderBrowserInput = new System.Windows.Forms.FolderBrowserDialog(); @@ -41,6 +41,14 @@ namespace Tidstagning this.buttonSave = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.comboBoxBaudRate = new System.Windows.Forms.ComboBox(); + this.panelRelaySettings = new System.Windows.Forms.Panel(); + this.panelRelaySettings.SuspendLayout(); this.SuspendLayout(); // // label1 @@ -52,15 +60,16 @@ namespace Tidstagning this.label1.TabIndex = 0; this.label1.Text = "Select folder for input files."; // - // checkBox1 + // checkBoxRelay // - this.checkBox1.AutoSize = true; - this.checkBox1.Location = new System.Drawing.Point(7, 98); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(95, 17); - this.checkBox1.TabIndex = 2; - this.checkBox1.Text = "Enable Relay?"; - this.checkBox1.UseVisualStyleBackColor = true; + this.checkBoxRelay.AutoSize = true; + this.checkBoxRelay.Location = new System.Drawing.Point(7, 98); + this.checkBoxRelay.Name = "checkBoxRelay"; + this.checkBoxRelay.Size = new System.Drawing.Size(95, 17); + this.checkBoxRelay.TabIndex = 2; + this.checkBoxRelay.Text = "Enable Relay?"; + this.checkBoxRelay.UseVisualStyleBackColor = true; + this.checkBoxRelay.CheckedChanged += new System.EventHandler(this.checkBoxRelay_CheckedChanged); // // folderBrowserOutput // @@ -136,6 +145,84 @@ namespace Tidstagning this.label2.TabIndex = 9; this.label2.Text = "Select folder for output files."; // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(259, 17); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(100, 20); + this.textBox2.TabIndex = 5; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(141, 17); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 20); + this.textBox1.TabIndex = 4; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(256, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(71, 13); + this.label5.TabIndex = 3; + this.label5.Text = "Off Command"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(138, 0); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(71, 13); + this.label4.TabIndex = 2; + this.label4.Text = "On Command"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(2, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(50, 13); + this.label3.TabIndex = 1; + this.label3.Text = "Baudrate"; + // + // comboBoxBaudRate + // + this.comboBoxBaudRate.FormattingEnabled = true; + this.comboBoxBaudRate.Items.AddRange(new object[] { + "110", + "150", + "300", + "1200", + "2400", + "4800", + "9600", + "19200", + "38400", + "57600", + "115200", + "230400", + "460800", + "921600"}); + this.comboBoxBaudRate.Location = new System.Drawing.Point(0, 16); + this.comboBoxBaudRate.Name = "comboBoxBaudRate"; + this.comboBoxBaudRate.Size = new System.Drawing.Size(121, 21); + this.comboBoxBaudRate.TabIndex = 0; + // + // panelRelaySettings + // + this.panelRelaySettings.Controls.Add(this.textBox2); + this.panelRelaySettings.Controls.Add(this.label5); + this.panelRelaySettings.Controls.Add(this.textBox1); + this.panelRelaySettings.Controls.Add(this.comboBoxBaudRate); + this.panelRelaySettings.Controls.Add(this.label3); + this.panelRelaySettings.Controls.Add(this.label4); + this.panelRelaySettings.Enabled = false; + this.panelRelaySettings.Location = new System.Drawing.Point(7, 121); + this.panelRelaySettings.Name = "panelRelaySettings"; + this.panelRelaySettings.Size = new System.Drawing.Size(386, 68); + this.panelRelaySettings.TabIndex = 11; + // // ConfigUI // this.AcceptButton = this.buttonSave; @@ -143,6 +230,7 @@ namespace Tidstagning this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.buttonCancel; this.ClientSize = new System.Drawing.Size(405, 315); + this.Controls.Add(this.panelRelaySettings); this.Controls.Add(this.label2); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonSave); @@ -150,15 +238,17 @@ namespace Tidstagning this.Controls.Add(this.textPathInput); this.Controls.Add(this.buttonFolderInput); this.Controls.Add(this.buttonFolderOutput); - this.Controls.Add(this.checkBox1); + this.Controls.Add(this.checkBoxRelay); this.Controls.Add(this.label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ConfigUI"; - this.Text = "Configuration"; + this.Text = "Configuration (Not working yet)"; this.TopMost = true; + this.panelRelaySettings.ResumeLayout(false); + this.panelRelaySettings.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -167,7 +257,7 @@ namespace Tidstagning #endregion private System.Windows.Forms.Label label1; - private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.CheckBox checkBoxRelay; private System.Windows.Forms.FolderBrowserDialog folderBrowserOutput; private System.Windows.Forms.Button buttonFolderOutput; private System.Windows.Forms.FolderBrowserDialog folderBrowserInput; @@ -177,5 +267,12 @@ namespace Tidstagning private System.Windows.Forms.Button buttonSave; private System.Windows.Forms.Button buttonCancel; private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ComboBox comboBoxBaudRate; + private System.Windows.Forms.Panel panelRelaySettings; } } \ No newline at end of file diff --git a/Tidstagning/ConfigUI.cs b/Tidstagning/ConfigUI.cs index f3fe0ad..d344f7c 100644 --- a/Tidstagning/ConfigUI.cs +++ b/Tidstagning/ConfigUI.cs @@ -39,5 +39,10 @@ namespace Tidstagning Properties.Settings.Default.Save(); this.Close(); } + + private void checkBoxRelay_CheckedChanged(object sender, EventArgs e) + { + panelRelaySettings.Enabled = checkBoxRelay.Enabled; + } } } diff --git a/Tidstagning/ConfigUI.resx b/Tidstagning/ConfigUI.resx index 87333b1..2ea699c 100644 --- a/Tidstagning/ConfigUI.resx +++ b/Tidstagning/ConfigUI.resx @@ -123,9 +123,6 @@ 183, 17 - - True - diff --git a/Tidstagning/MainUI.Designer.cs b/Tidstagning/MainUI.Designer.cs index 38b1166..16706ca 100644 --- a/Tidstagning/MainUI.Designer.cs +++ b/Tidstagning/MainUI.Designer.cs @@ -45,26 +45,29 @@ this.DNF = new System.Windows.Forms.DataGridViewButtonColumn(); this.entryBindingSource = new System.Windows.Forms.BindingSource(this.components); this.txtLog = new System.Windows.Forms.TableLayoutPanel(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.comboSoundTime = new System.Windows.Forms.ComboBox(); + this.lblClock = new System.Windows.Forms.Label(); + this.flowLayoutPanelConfiguration = new System.Windows.Forms.FlowLayoutPanel(); + this.numericSignalLength = new System.Windows.Forms.NumericUpDown(); this.label1 = new System.Windows.Forms.Label(); this.comboComport = new System.Windows.Forms.ComboBox(); - this.lblClock = new System.Windows.Forms.Label(); - this.Clock = new System.Windows.Forms.Timer(this.components); + this.label2 = new System.Windows.Forms.Label(); this.buttonConfig = new System.Windows.Forms.Button(); + this.Clock = new System.Windows.Forms.Timer(this.components); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).BeginInit(); this.txtLog.SuspendLayout(); - this.flowLayoutPanel1.SuspendLayout(); + this.flowLayoutPanelConfiguration.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericSignalLength)).BeginInit(); this.SuspendLayout(); // // btnTest // + this.btnTest.Dock = System.Windows.Forms.DockStyle.Bottom; this.btnTest.Font = new System.Drawing.Font("Microsoft Sans Serif", 18.25F); - this.btnTest.Location = new System.Drawing.Point(3, 3); + this.btnTest.Location = new System.Drawing.Point(0, 464); this.btnTest.Name = "btnTest"; - this.btnTest.Size = new System.Drawing.Size(185, 37); + this.btnTest.Size = new System.Drawing.Size(264, 37); this.btnTest.TabIndex = 3; this.btnTest.Text = "HORN 🔊"; this.btnTest.UseVisualStyleBackColor = true; @@ -72,7 +75,7 @@ // // buttonHelp // - this.buttonHelp.Location = new System.Drawing.Point(3, 100); + this.buttonHelp.Location = new System.Drawing.Point(3, 56); this.buttonHelp.Name = "buttonHelp"; this.buttonHelp.Size = new System.Drawing.Size(75, 23); this.buttonHelp.TabIndex = 14; @@ -94,6 +97,7 @@ // // panel1 // + this.panel1.Controls.Add(this.btnTest); this.panel1.Controls.Add(this.textStartProcedure); this.panel1.Controls.Add(this.checkStartProcedure); this.panel1.Controls.Add(this.btnStart); @@ -114,7 +118,7 @@ this.textStartProcedure.Name = "textStartProcedure"; this.textStartProcedure.ReadOnly = true; this.textStartProcedure.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textStartProcedure.Size = new System.Drawing.Size(258, 361); + this.textStartProcedure.Size = new System.Drawing.Size(258, 311); this.textStartProcedure.TabIndex = 10; this.textStartProcedure.WordWrap = false; // @@ -134,9 +138,9 @@ this.btnStart.Font = new System.Drawing.Font("Microsoft Sans Serif", 18.25F); this.btnStart.Location = new System.Drawing.Point(3, 3); this.btnStart.Name = "btnStart"; - this.btnStart.Size = new System.Drawing.Size(185, 37); + this.btnStart.Size = new System.Drawing.Size(258, 37); this.btnStart.TabIndex = 4; - this.btnStart.Text = "Start"; + this.btnStart.Text = "Start ▶"; this.btnStart.UseVisualStyleBackColor = true; this.btnStart.Click += new System.EventHandler(this.btnStart_Click); // @@ -146,9 +150,9 @@ this.btnStop.Font = new System.Drawing.Font("Microsoft Sans Serif", 18.25F); this.btnStop.Location = new System.Drawing.Point(3, 46); this.btnStop.Name = "btnStop"; - this.btnStop.Size = new System.Drawing.Size(185, 40); + this.btnStop.Size = new System.Drawing.Size(258, 40); this.btnStop.TabIndex = 6; - this.btnStop.Text = "Stop"; + this.btnStop.Text = "Stop ■"; this.btnStop.UseVisualStyleBackColor = true; this.btnStop.Click += new System.EventHandler(this.btnStop_Click); // @@ -232,9 +236,9 @@ this.txtLog.Controls.Add(this.grid, 1, 0); this.txtLog.Controls.Add(this.txtHeader, 0, 0); this.txtLog.Controls.Add(this.txtDebug, 1, 2); - this.txtLog.Controls.Add(this.flowLayoutPanel1, 0, 2); this.txtLog.Controls.Add(this.lblClock, 2, 2); this.txtLog.Controls.Add(this.panel1, 0, 1); + this.txtLog.Controls.Add(this.flowLayoutPanelConfiguration, 0, 2); this.txtLog.Dock = System.Windows.Forms.DockStyle.Fill; this.txtLog.Location = new System.Drawing.Point(0, 0); this.txtLog.Name = "txtLog"; @@ -242,60 +246,10 @@ this.txtLog.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.txtLog.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 77.77778F)); this.txtLog.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 22.22222F)); + this.txtLog.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.txtLog.Size = new System.Drawing.Size(1315, 694); this.txtLog.TabIndex = 8; // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.Controls.Add(this.btnTest); - this.flowLayoutPanel1.Controls.Add(this.comboSoundTime); - this.flowLayoutPanel1.Controls.Add(this.label1); - this.flowLayoutPanel1.Controls.Add(this.comboComport); - this.flowLayoutPanel1.Controls.Add(this.buttonHelp); - this.flowLayoutPanel1.Controls.Add(this.buttonConfig); - this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 551); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(194, 125); - this.flowLayoutPanel1.TabIndex = 15; - // - // comboSoundTime - // - this.comboSoundTime.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboSoundTime.FormattingEnabled = true; - this.comboSoundTime.Items.AddRange(new object[] { - "500", - "750", - "1000", - "1250", - "1500", - "1750", - "2000", - "5000"}); - this.comboSoundTime.Location = new System.Drawing.Point(3, 46); - this.comboSoundTime.Name = "comboSoundTime"; - this.comboSoundTime.Size = new System.Drawing.Size(97, 21); - this.comboSoundTime.TabIndex = 26; - this.comboSoundTime.SelectionChangeCommitted += new System.EventHandler(this.comboSoundTime_SelectedIndexChanged); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(106, 43); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(68, 13); - this.label1.TabIndex = 27; - this.label1.Text = "Millisekunder"; - // - // comboComport - // - this.comboComport.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboComport.FormattingEnabled = true; - this.comboComport.Location = new System.Drawing.Point(3, 73); - this.comboComport.Name = "comboComport"; - this.comboComport.Size = new System.Drawing.Size(121, 21); - this.comboComport.TabIndex = 28; - this.comboComport.SelectedIndexChanged += new System.EventHandler(this.comboComport_SelectedIndexChanged); - // // lblClock // this.lblClock.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -310,14 +264,81 @@ this.lblClock.Text = "--:--:--"; this.lblClock.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // Clock + // flowLayoutPanelConfiguration // - this.Clock.Enabled = true; - this.Clock.Tick += new System.EventHandler(this.Clock_Tick); + this.flowLayoutPanelConfiguration.Controls.Add(this.numericSignalLength); + this.flowLayoutPanelConfiguration.Controls.Add(this.label1); + this.flowLayoutPanelConfiguration.Controls.Add(this.comboComport); + this.flowLayoutPanelConfiguration.Controls.Add(this.label2); + this.flowLayoutPanelConfiguration.Controls.Add(this.buttonHelp); + this.flowLayoutPanelConfiguration.Controls.Add(this.buttonConfig); + this.flowLayoutPanelConfiguration.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanelConfiguration.Location = new System.Drawing.Point(3, 551); + this.flowLayoutPanelConfiguration.Name = "flowLayoutPanelConfiguration"; + this.flowLayoutPanelConfiguration.Size = new System.Drawing.Size(264, 140); + this.flowLayoutPanelConfiguration.TabIndex = 15; + // + // numericSignalLength + // + this.numericSignalLength.Increment = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.numericSignalLength.Location = new System.Drawing.Point(3, 3); + this.numericSignalLength.Maximum = new decimal(new int[] { + 5000, + 0, + 0, + 0}); + this.numericSignalLength.Minimum = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.numericSignalLength.Name = "numericSignalLength"; + this.numericSignalLength.Size = new System.Drawing.Size(121, 20); + this.numericSignalLength.TabIndex = 30; + this.numericSignalLength.Value = new decimal(new int[] { + 500, + 0, + 0, + 0}); + this.numericSignalLength.ValueChanged += new System.EventHandler(this.numericSignalLength_ValueChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(130, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(121, 24); + this.label1.TabIndex = 27; + this.label1.Text = "Millisekunder"; + // + // comboComport + // + this.comboComport.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboComport.FormattingEnabled = true; + this.comboComport.Location = new System.Drawing.Point(3, 29); + this.comboComport.Name = "comboComport"; + this.comboComport.Size = new System.Drawing.Size(121, 21); + this.comboComport.TabIndex = 28; + this.comboComport.SelectedIndexChanged += new System.EventHandler(this.comboComport_SelectedIndexChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(130, 26); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(88, 24); + this.label2.TabIndex = 31; + this.label2.Text = "Com Port"; // // buttonConfig // - this.buttonConfig.Location = new System.Drawing.Point(84, 100); + this.buttonConfig.Location = new System.Drawing.Point(84, 56); this.buttonConfig.Name = "buttonConfig"; this.buttonConfig.Size = new System.Drawing.Size(90, 23); this.buttonConfig.TabIndex = 29; @@ -325,6 +346,11 @@ this.buttonConfig.UseVisualStyleBackColor = true; this.buttonConfig.Click += new System.EventHandler(this.buttonConfig_Click); // + // Clock + // + this.Clock.Enabled = true; + this.Clock.Tick += new System.EventHandler(this.Clock_Tick); + // // MainUI // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -345,8 +371,9 @@ ((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).EndInit(); this.txtLog.ResumeLayout(false); this.txtLog.PerformLayout(); - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); + this.flowLayoutPanelConfiguration.ResumeLayout(false); + this.flowLayoutPanelConfiguration.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericSignalLength)).EndInit(); this.ResumeLayout(false); } @@ -363,8 +390,7 @@ private System.Windows.Forms.TextBox txtHeader; private System.Windows.Forms.DataGridView grid; private System.Windows.Forms.TableLayoutPanel txtLog; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - private System.Windows.Forms.ComboBox comboSoundTime; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelConfiguration; private System.Windows.Forms.DataGridViewButtonColumn Complete; private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewButtonColumn DNF; @@ -375,6 +401,8 @@ private System.Windows.Forms.Label lblClock; private System.Windows.Forms.TextBox textStartProcedure; private System.Windows.Forms.Button buttonConfig; + private System.Windows.Forms.NumericUpDown numericSignalLength; + private System.Windows.Forms.Label label2; } } diff --git a/Tidstagning/MainUI.cs b/Tidstagning/MainUI.cs index c0a282b..1e961b5 100644 --- a/Tidstagning/MainUI.cs +++ b/Tidstagning/MainUI.cs @@ -27,28 +27,16 @@ namespace Tidstagning } deltager_handle.Dispose(); - comboSoundTime.SelectedIndex = 0; - foreach (string port in Relay.GetPorts()) { comboComport.Items.Add(port); } checkStartProcedure.Checked = Properties.Settings.Default.AutoStartProcedure; - - uint signalLength = Properties.Settings.Default.SignalLength; - int index = comboSoundTime.Items.IndexOf(signalLength.ToString()); - if (index == -1) - { - comboSoundTime.SelectedIndex = 0; - } - else - { - comboSoundTime.SelectedIndex = index; - } + numericSignalLength.Value = (decimal)Properties.Settings.Default.SignalLength; string comport = Properties.Settings.Default.ComPort; - index = comboComport.Items.IndexOf(comport); + int index = comboComport.Items.IndexOf(comport); if (index == -1) { comboComport.SelectedIndex = 0; @@ -101,7 +89,7 @@ namespace Tidstagning grid.CurrentCell = null; entries.RemoveAt(e.RowIndex); - horn.Sound(int.Parse(comboSoundTime.SelectedItem.ToString())); + horn.Sound((uint)numericSignalLength.Value); } grid.Refresh(); } @@ -118,8 +106,7 @@ namespace Tidstagning btnStart.Enabled = false; btnStop.Enabled = true; checkStartProcedure.Enabled = false; - comboComport.Enabled = false; - comboSoundTime.Enabled = false; + flowLayoutPanelConfiguration.Enabled = false; if (checkStartProcedure.Checked) { liste.Write("Automatisk Start Procedure er aktiv."); @@ -139,9 +126,7 @@ namespace Tidstagning liste.WriteFooter(); liste.Close(); checkStartProcedure.Enabled = true; - comboComport.Enabled = true; - comboSoundTime.Enabled = true; - startprocedure.Clear(); + flowLayoutPanelConfiguration.Enabled = true; } private void buttonHelp_Click(object sender, EventArgs e) @@ -152,7 +137,7 @@ namespace Tidstagning private void btnTest_Click(object sender, EventArgs e) { - horn.Sound(int.Parse(comboSoundTime.SelectedItem.ToString())); + horn.Sound((uint)numericSignalLength.Value); } private void Clock_Tick(object sender, EventArgs e) @@ -164,14 +149,6 @@ namespace Tidstagning } } - private void comboSoundTime_SelectedIndexChanged(object sender, EventArgs e) - { - startprocedure.adjustSignalLength(int.Parse(comboSoundTime.SelectedItem.ToString())); - uint signalLength = uint.Parse(comboSoundTime.SelectedItem.ToString()); - Properties.Settings.Default.SignalLength = signalLength; - Properties.Settings.Default.Save(); - } - private void comboComport_SelectedIndexChanged(object sender, EventArgs e) { if (comboComport.Items.Count != 0) @@ -191,7 +168,6 @@ namespace Tidstagning startprocedure.ReadFile(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/Tidstagning/" + "Startprocedure.txt"); } - Properties.Settings.Default.AutoStartProcedure = checkStartProcedure.Checked; Properties.Settings.Default.Save(); } @@ -232,10 +208,15 @@ namespace Tidstagning private void buttonConfig_Click(object sender, EventArgs e) { - this.flowLayoutPanel1.Enabled = false; ConfigUI configui = new ConfigUI(); configui.ShowDialog(); - this.flowLayoutPanel1.Enabled = true; + } + + private void numericSignalLength_ValueChanged(object sender, EventArgs e) + { + startprocedure.adjustSignalLength((uint)numericSignalLength.Value); + Properties.Settings.Default.SignalLength = (uint)numericSignalLength.Value; + Properties.Settings.Default.Save(); } } } diff --git a/Tidstagning/Procedure.cs b/Tidstagning/Procedure.cs index 25a6cd5..9429cbf 100644 --- a/Tidstagning/Procedure.cs +++ b/Tidstagning/Procedure.cs @@ -10,7 +10,7 @@ namespace Tidstagning Relay horn; ResultList log; List signaler; - int signalLength = 500; + uint signalLength = 500; Timer timer; Int16 idx = 0; @@ -88,7 +88,7 @@ namespace Tidstagning Run(); } - public void adjustSignalLength(int lengthMS) + public void adjustSignalLength(uint lengthMS) { signalLength = lengthMS; } diff --git a/Tidstagning/Relay.cs b/Tidstagning/Relay.cs index 001c4ea..d75ef28 100644 --- a/Tidstagning/Relay.cs +++ b/Tidstagning/Relay.cs @@ -9,7 +9,7 @@ namespace Tidstagning { SerialPort com; Timer cooldownTimer; - Queue signals = new Queue(); + Queue signals = new Queue(); public Relay(string ComPort = null) { com = new SerialPort(); @@ -42,7 +42,7 @@ namespace Tidstagning * Sound the horn for a given time * Uses a thread to postpone the off call. */ - public void Sound(int time) + public void Sound(uint time) { Debug.WriteLine("Requesting horn for: " + time.ToString() + "ms"); signals.Enqueue(time);