diff --git a/Tidstagning/Form1.Designer.cs b/Tidstagning/Form1.Designer.cs
index 74182e3..a914211 100644
--- a/Tidstagning/Form1.Designer.cs
+++ b/Tidstagning/Form1.Designer.cs
@@ -48,19 +48,20 @@
this.txtHeader = new System.Windows.Forms.TextBox();
this.grid = new System.Windows.Forms.DataGridView();
this.Complete = new System.Windows.Forms.DataGridViewButtonColumn();
- this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
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.Clock = new System.Windows.Forms.Timer(this.components);
+ this.label1 = new System.Windows.Forms.Label();
+ this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.entryBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).BeginInit();
this.txtLog.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).BeginInit();
this.SuspendLayout();
//
// countdowntimer
@@ -75,7 +76,7 @@
this.btnTest.Name = "btnTest";
this.btnTest.Size = new System.Drawing.Size(185, 37);
this.btnTest.TabIndex = 3;
- this.btnTest.Text = "Test";
+ this.btnTest.Text = "Test horn";
this.btnTest.UseVisualStyleBackColor = true;
this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
//
@@ -191,7 +192,7 @@
// btnAutoStart
//
this.btnAutoStart.Font = new System.Drawing.Font("Microsoft Sans Serif", 18.25F);
- this.btnAutoStart.Location = new System.Drawing.Point(0, 7);
+ this.btnAutoStart.Location = new System.Drawing.Point(3, 3);
this.btnAutoStart.Name = "btnAutoStart";
this.btnAutoStart.Size = new System.Drawing.Size(185, 37);
this.btnAutoStart.TabIndex = 4;
@@ -203,9 +204,9 @@
//
this.btnStop.Enabled = false;
this.btnStop.Font = new System.Drawing.Font("Microsoft Sans Serif", 18.25F);
- this.btnStop.Location = new System.Drawing.Point(0, 50);
+ this.btnStop.Location = new System.Drawing.Point(3, 46);
this.btnStop.Name = "btnStop";
- this.btnStop.Size = new System.Drawing.Size(182, 40);
+ this.btnStop.Size = new System.Drawing.Size(185, 40);
this.btnStop.TabIndex = 6;
this.btnStop.Text = "Stop";
this.btnStop.UseVisualStyleBackColor = true;
@@ -255,13 +256,6 @@
this.Complete.ReadOnly = true;
this.Complete.Text = "Mål";
//
- // nameDataGridViewTextBoxColumn
- //
- this.nameDataGridViewTextBoxColumn.DataPropertyName = "SailNumber";
- this.nameDataGridViewTextBoxColumn.HeaderText = "Sejlnummer";
- this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
- this.nameDataGridViewTextBoxColumn.ReadOnly = true;
- //
// DNF
//
this.DNF.HeaderText = "DNF";
@@ -270,10 +264,6 @@
this.DNF.Text = "Udgået";
this.DNF.UseColumnTextForButtonValue = true;
//
- // entryBindingSource
- //
- this.entryBindingSource.DataSource = typeof(Tidstagning.Entry);
- //
// txtLog
//
this.txtLog.ColumnCount = 3;
@@ -302,6 +292,7 @@
//
this.flowLayoutPanel1.Controls.Add(this.btnTest);
this.flowLayoutPanel1.Controls.Add(this.comboSoundTime);
+ this.flowLayoutPanel1.Controls.Add(this.label1);
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 311);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(194, 73);
@@ -323,15 +314,34 @@
"5000"});
this.comboSoundTime.Location = new System.Drawing.Point(3, 46);
this.comboSoundTime.Name = "comboSoundTime";
- this.comboSoundTime.Size = new System.Drawing.Size(121, 21);
+ this.comboSoundTime.Size = new System.Drawing.Size(97, 21);
this.comboSoundTime.TabIndex = 26;
//
// Clock
//
this.Clock.Enabled = true;
- this.Clock.Interval = 1000;
this.Clock.Tick += new System.EventHandler(this.Clock_Tick);
//
+ // 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";
+ //
+ // nameDataGridViewTextBoxColumn
+ //
+ this.nameDataGridViewTextBoxColumn.DataPropertyName = "SailNumber";
+ this.nameDataGridViewTextBoxColumn.HeaderText = "Sejlnummer";
+ this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
+ this.nameDataGridViewTextBoxColumn.ReadOnly = true;
+ //
+ // entryBindingSource
+ //
+ this.entryBindingSource.DataSource = typeof(Tidstagning.Entry);
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -341,7 +351,7 @@
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
- this.Text = "Tidstagning Copyright © 2014 LEAX A/S";
+ this.Text = "Tidstagning";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.HelpButtonClicked += new System.ComponentModel.CancelEventHandler(this.Form1_HelpButtonClicked);
this.Load += new System.EventHandler(this.Form1_Load);
@@ -349,10 +359,11 @@
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.grid)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).EndInit();
this.txtLog.ResumeLayout(false);
this.txtLog.PerformLayout();
this.flowLayoutPanel1.ResumeLayout(false);
+ this.flowLayoutPanel1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).EndInit();
this.ResumeLayout(false);
}
@@ -383,7 +394,7 @@
private System.Windows.Forms.Label lblClock;
private System.Windows.Forms.CheckBox checkStartProcedure;
private System.Windows.Forms.Timer Clock;
-
+ private System.Windows.Forms.Label label1;
}
}
diff --git a/Tidstagning/Form1.cs b/Tidstagning/Form1.cs
index 78b5761..59f6a2f 100644
--- a/Tidstagning/Form1.cs
+++ b/Tidstagning/Form1.cs
@@ -36,12 +36,16 @@ namespace Tidstagning
}
procedure_handle.Dispose();
+
foreach(string port in Relay.GetPorts()) {
comboComport.Items.Add(port);
}
comboSoundTime.SelectedIndex = 3;
- comboComport.SelectedIndex = 0;
+ if (comboComport.Items.Count != 0)
+ {
+ comboComport.SelectedIndex = 0;
+ }
}
@@ -140,9 +144,10 @@ namespace Tidstagning
liste.WriteHeader(txtHeader.Text);
btnAutoStart.Enabled = false;
btnStop.Enabled = true;
-
- horn = new Relay(comboComport.SelectedItem.ToString());
-
+ if (comboComport.Items.Count != 0)
+ {
+ horn = new Relay(comboComport.SelectedItem.ToString());
+ }
if (checkStartProcedure.Checked)
{
startprocedure.setObjects(horn, liste);
diff --git a/Tidstagning/Form1.resx b/Tidstagning/Form1.resx
index 0927351..6ffc091 100644
--- a/Tidstagning/Form1.resx
+++ b/Tidstagning/Form1.resx
@@ -112,30 +112,30 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
165, 17
-
+
True
-
+
True
-
+
True
-
+
17, 17
-
+
297, 17
-
+
AAABAAYAAAAAAAEAIABLFAAAZgAAACAgAAABACAAqBAAALEUAAAwMAAAAQAgAKglAABZJQAAEBAAAAEA
diff --git a/Tidstagning/Properties/AssemblyInfo.cs b/Tidstagning/Properties/AssemblyInfo.cs
index a4eea09..154bc7e 100644
--- a/Tidstagning/Properties/AssemblyInfo.cs
+++ b/Tidstagning/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Tidstagning")]
-[assembly: AssemblyDescription("Contact jens.chr.true@gmail.com - https://jcktrue.dk")]
+[assembly: AssemblyDescription("Kontakt jens.chr.true@gmail.com - https://jcktrue.dk")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("LEAX")]
[assembly: AssemblyProduct("Tidstagning")]
-[assembly: AssemblyCopyright("Copyright © 2020")]
+[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/Tidstagning/Relay.cs b/Tidstagning/Relay.cs
index f862c56..3807aba 100644
--- a/Tidstagning/Relay.cs
+++ b/Tidstagning/Relay.cs
@@ -4,26 +4,47 @@ namespace Tidstagning
class Relay
{
SerialPort com;
- public Relay(string ComPort)
+ public Relay(string ComPort = null)
{
com = new SerialPort();
com.PortName = ComPort;
com.BaudRate = 9600;
- com.Open();
+ try
+ {
+ com.Open();
+ } catch
+ {
+
+ }
}
public void Set(int output, byte state) {
byte[] command = {0xff, 0x01, state};
- com.Write(command, 0, 3);
+ if (com.IsOpen)
+ {
+ com.Write(command, 0, 3);
+ }
}
public void Close() {
- if(com.IsOpen)
+ if (com.IsOpen)
+ {
com.Close();
+ }
}
public static string[] GetPorts()
{
- return SerialPort.GetPortNames();
+ string[] ports;
+
+ if (SerialPort.GetPortNames().Length != 0)
+ {
+ ports = SerialPort.GetPortNames();
+ }
+ else
+ {
+ ports = new string[]{ "N/A" };
+ }
+ return ports;
}
}
}
diff --git a/Tidstagning/Startprocedure.txt b/Tidstagning/Startprocedure.txt
new file mode 100644
index 0000000..0abc604
--- /dev/null
+++ b/Tidstagning/Startprocedure.txt
@@ -0,0 +1,4 @@
+18:00:00,200
+18:01:00,200
+18:04:00,200
+18:05:00,500
\ No newline at end of file
diff --git a/Tidstagning/Tidstagning.csproj b/Tidstagning/Tidstagning.csproj
index e8d08d8..46462b2 100644
--- a/Tidstagning/Tidstagning.csproj
+++ b/Tidstagning/Tidstagning.csproj
@@ -45,10 +45,10 @@
DEBUG;TRACE
prompt
4
- true
+ false
- x86
+ AnyCPU
pdbonly
true
bin\Release\
diff --git a/Tidstagning/Tidstagning.csproj.user b/Tidstagning/Tidstagning.csproj.user
index b97c42b..4664eeb 100644
--- a/Tidstagning/Tidstagning.csproj.user
+++ b/Tidstagning/Tidstagning.csproj.user
@@ -9,5 +9,6 @@
en-US
false
+ ShowAllFiles
\ No newline at end of file