Build enabled

This commit is contained in:
Jens True 2022-05-02 17:36:09 +02:00
parent 369f1934d3
commit dac937873e
2 changed files with 12 additions and 9 deletions

@ -4,16 +4,16 @@ namespace Tidstagning
{ {
class Entry class Entry
{ {
enum Score public enum Score
{ {
-, Score,
DNC, DNC,
DNS, DNS,
OCS, OCS,
DNF, DNF,
RET, RET,
DSQ DSQ
} };
//Competitors name //Competitors name
public string Name { get; set; } public string Name { get; set; }
//Competitor identifier (Sailnumber/Bownumber or other) //Competitor identifier (Sailnumber/Bownumber or other)
@ -21,7 +21,7 @@ namespace Tidstagning
//DateTime the user completed the course //DateTime the user completed the course
public DateTime Completed_Time { get; set; } public DateTime Completed_Time { get; set; }
//Retirement score. //Retirement score.
public Score Code {get; set; } public Score Code { get; set; }
public Entry(string name, string number) public Entry(string name, string number)
{ {
@ -37,7 +37,7 @@ namespace Tidstagning
public void DNF() public void DNF()
{ {
Code = DNF; Code = Score.DNF;
this.Completed_Time = DateTime.Now; this.Completed_Time = DateTime.Now;
} }
} }

@ -22,20 +22,23 @@ namespace Tidstagning
{ {
} }
public Open(string ComPort) public bool Open(string ComPort)
{ {
if(SerialPort.IsOpen()) if (com.IsOpen)
SerialPort.Close(); {
Close();
}
com.PortName = ComPort; com.PortName = ComPort;
com.BaudRate = 9600; com.BaudRate = 9600;
try try
{ {
com.Open(); com.Open();
return true;
} }
catch catch
{ {
return false;
} }
} }