From dac937873e499d06f45075e30140901209f839a5 Mon Sep 17 00:00:00 2001 From: Jens True Date: Mon, 2 May 2022 17:36:09 +0200 Subject: [PATCH] Build enabled --- Tidstagning/Entry.cs | 10 +++++----- Tidstagning/Relay.cs | 11 +++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Tidstagning/Entry.cs b/Tidstagning/Entry.cs index 42ad4fa..4c274da 100644 --- a/Tidstagning/Entry.cs +++ b/Tidstagning/Entry.cs @@ -4,16 +4,16 @@ namespace Tidstagning { class Entry { - enum Score + public enum Score { - -, + Score, DNC, DNS, OCS, DNF, RET, DSQ - } + }; //Competitors name public string Name { get; set; } //Competitor identifier (Sailnumber/Bownumber or other) @@ -21,7 +21,7 @@ namespace Tidstagning //DateTime the user completed the course public DateTime Completed_Time { get; set; } //Retirement score. - public Score Code {get; set; } + public Score Code { get; set; } public Entry(string name, string number) { @@ -37,7 +37,7 @@ namespace Tidstagning public void DNF() { - Code = DNF; + Code = Score.DNF; this.Completed_Time = DateTime.Now; } } diff --git a/Tidstagning/Relay.cs b/Tidstagning/Relay.cs index a0ac7e3..dbccdab 100644 --- a/Tidstagning/Relay.cs +++ b/Tidstagning/Relay.cs @@ -22,20 +22,23 @@ namespace Tidstagning { } - public Open(string ComPort) + public bool Open(string ComPort) { - if(SerialPort.IsOpen()) - SerialPort.Close(); + if (com.IsOpen) + { + Close(); + } com.PortName = ComPort; com.BaudRate = 9600; try { com.Open(); + return true; } catch { - + return false; } }