Initial import

This commit is contained in:
Jens True 2020-04-21 17:47:38 +02:00
commit 1e288d97f7
20 changed files with 1204 additions and 0 deletions

1
.gitignore vendored Normal file

@ -0,0 +1 @@
.vs

20
Tidstagning.sln Normal file

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tidstagning", "Tidstagning\Tidstagning.csproj", "{DFE0844B-9986-4623-8188-7F4A828FBB02}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DFE0844B-9986-4623-8188-7F4A828FBB02}.Debug|x86.ActiveCfg = Debug|x86
{DFE0844B-9986-4623-8188-7F4A828FBB02}.Debug|x86.Build.0 = Debug|x86
{DFE0844B-9986-4623-8188-7F4A828FBB02}.Release|x86.ActiveCfg = Release|x86
{DFE0844B-9986-4623-8188-7F4A828FBB02}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

BIN
Tidstagning.suo Normal file

Binary file not shown.

16
Tidstagning/Deltager.txt Normal file

@ -0,0 +1,16 @@
Opus,1
Cartan,13
Dixi,26
Grace,28
Sanus,19
Blup,12
Fønix,16
Krone 2,99
Den sorte enke,38
Havfruen,18
Nicoline,66
Mamse,99
Mallue,11
Buggabo,9
Marie,2
Splinten,11

33
Tidstagning/Entry.cs Normal file

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tidstagning
{
class Entry
{
public string Name { get; set; }
public string SailNumber { get; set; }
public DateTime Completed_Time { get; set; }
public Entry(string name, string number)
{
this.Name = name;
this.SailNumber = number;
this.Completed_Time = DateTime.Today;
}
public void Complete()
{
this.Completed_Time = DateTime.Now;
}
public void DNF()
{
this.Completed_Time = DateTime.Now;
}
}
}

296
Tidstagning/Form1.Designer.cs generated Normal file

@ -0,0 +1,296 @@
namespace Tidstagning
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
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.btnMoveUp = new System.Windows.Forms.Button();
this.btnMoveDown = new System.Windows.Forms.Button();
this.txtHeader = new System.Windows.Forms.TextBox();
this.btnAutoStart = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.countdowntimer = new System.Windows.Forms.Timer(this.components);
this.txtLog = new System.Windows.Forms.TableLayoutPanel();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.txtDebug = new System.Windows.Forms.TextBox();
this.comboComport = new System.Windows.Forms.ComboBox();
this.comboSoundTime = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).BeginInit();
this.txtLog.SuspendLayout();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// grid
//
this.grid.AllowUserToAddRows = false;
this.grid.AllowUserToDeleteRows = false;
this.grid.AutoGenerateColumns = false;
this.grid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.grid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Complete,
this.nameDataGridViewTextBoxColumn,
this.DNF});
this.grid.DataSource = this.entryBindingSource;
this.grid.Dock = System.Windows.Forms.DockStyle.Fill;
this.grid.Location = new System.Drawing.Point(203, 41);
this.grid.Name = "grid";
this.grid.ReadOnly = true;
this.grid.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grid.RowsDefaultCellStyle = dataGridViewCellStyle1;
this.grid.RowTemplate.Height = 35;
this.grid.Size = new System.Drawing.Size(698, 264);
this.grid.TabIndex = 0;
this.grid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_Click);
this.grid.CellMouseEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellMouseEnter);
this.grid.CellMouseLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellMouseLeave);
//
// Complete
//
this.Complete.HeaderText = "Fuldført";
this.Complete.Name = "Complete";
this.Complete.ReadOnly = true;
this.Complete.Text = "Mål";
this.Complete.UseColumnTextForButtonValue = true;
//
// nameDataGridViewTextBoxColumn
//
this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
this.nameDataGridViewTextBoxColumn.HeaderText = "Båd";
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
this.nameDataGridViewTextBoxColumn.ReadOnly = true;
//
// DNF
//
this.DNF.HeaderText = "DNF";
this.DNF.Name = "DNF";
this.DNF.ReadOnly = true;
this.DNF.Text = "Udgået";
this.DNF.UseColumnTextForButtonValue = true;
//
// entryBindingSource
//
this.entryBindingSource.DataSource = typeof(Tidstagning.Entry);
//
// btnMoveUp
//
this.btnMoveUp.Location = new System.Drawing.Point(0, 0);
this.btnMoveUp.Name = "btnMoveUp";
this.btnMoveUp.Size = new System.Drawing.Size(101, 23);
this.btnMoveUp.TabIndex = 1;
this.btnMoveUp.Text = "Op";
this.btnMoveUp.UseVisualStyleBackColor = true;
this.btnMoveUp.Click += new System.EventHandler(this.btnMoveUp_Click);
//
// btnMoveDown
//
this.btnMoveDown.Location = new System.Drawing.Point(0, 29);
this.btnMoveDown.Name = "btnMoveDown";
this.btnMoveDown.Size = new System.Drawing.Size(101, 23);
this.btnMoveDown.TabIndex = 2;
this.btnMoveDown.Text = "Ned";
this.btnMoveDown.UseVisualStyleBackColor = true;
this.btnMoveDown.Click += new System.EventHandler(this.btnMoveDown_Click);
//
// txtHeader
//
this.txtHeader.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtHeader.Location = new System.Drawing.Point(203, 3);
this.txtHeader.Name = "txtHeader";
this.txtHeader.Size = new System.Drawing.Size(698, 20);
this.txtHeader.TabIndex = 3;
//
// btnAutoStart
//
this.btnAutoStart.Font = new System.Drawing.Font("Microsoft Sans Serif", 18.25F);
this.btnAutoStart.Location = new System.Drawing.Point(0, 7);
this.btnAutoStart.Name = "btnAutoStart";
this.btnAutoStart.Size = new System.Drawing.Size(185, 37);
this.btnAutoStart.TabIndex = 4;
this.btnAutoStart.Text = "Start";
this.btnAutoStart.UseVisualStyleBackColor = true;
this.btnAutoStart.Click += new System.EventHandler(this.btnAutoStart_Click);
//
// btnStop
//
this.btnStop.Enabled = false;
this.btnStop.Font = new System.Drawing.Font("Microsoft Sans Serif", 18.25F);
this.btnStop.Location = new System.Drawing.Point(3, 50);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(182, 40);
this.btnStop.TabIndex = 6;
this.btnStop.Text = "Stop";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// countdowntimer
//
this.countdowntimer.Interval = 1000;
this.countdowntimer.Tick += new System.EventHandler(this.timer_Tick);
//
// txtLog
//
this.txtLog.ColumnCount = 3;
this.txtLog.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 200F));
this.txtLog.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.txtLog.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 200F));
this.txtLog.Controls.Add(this.grid, 1, 1);
this.txtLog.Controls.Add(this.txtHeader, 1, 0);
this.txtLog.Controls.Add(this.panel1, 2, 1);
this.txtLog.Controls.Add(this.panel2, 0, 1);
this.txtLog.Controls.Add(this.txtDebug, 1, 2);
this.txtLog.Controls.Add(this.comboComport, 0, 2);
this.txtLog.Controls.Add(this.comboSoundTime, 2, 2);
this.txtLog.Controls.Add(this.label1, 0, 0);
this.txtLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtLog.Location = new System.Drawing.Point(0, 0);
this.txtLog.Name = "txtLog";
this.txtLog.RowCount = 3;
this.txtLog.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
this.txtLog.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 70F));
this.txtLog.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.txtLog.Size = new System.Drawing.Size(1104, 387);
this.txtLog.TabIndex = 8;
//
// panel1
//
this.panel1.Controls.Add(this.btnAutoStart);
this.panel1.Controls.Add(this.btnStop);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(907, 41);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(194, 264);
this.panel1.TabIndex = 8;
//
// panel2
//
this.panel2.Controls.Add(this.btnMoveUp);
this.panel2.Controls.Add(this.btnMoveDown);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(3, 41);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(194, 264);
this.panel2.TabIndex = 9;
//
// txtDebug
//
this.txtDebug.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtDebug.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F);
this.txtDebug.Location = new System.Drawing.Point(203, 311);
this.txtDebug.Multiline = true;
this.txtDebug.Name = "txtDebug";
this.txtDebug.Size = new System.Drawing.Size(698, 73);
this.txtDebug.TabIndex = 10;
//
// comboComport
//
this.comboComport.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboComport.FormattingEnabled = true;
this.comboComport.Location = new System.Drawing.Point(3, 311);
this.comboComport.Name = "comboComport";
this.comboComport.Size = new System.Drawing.Size(121, 21);
this.comboComport.TabIndex = 12;
//
// comboSoundTime
//
this.comboSoundTime.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboSoundTime.FormattingEnabled = true;
this.comboSoundTime.Items.AddRange(new object[] {
"100",
"250",
"500",
"1000"});
this.comboSoundTime.Location = new System.Drawing.Point(907, 311);
this.comboSoundTime.Name = "comboSoundTime";
this.comboSoundTime.Size = new System.Drawing.Size(121, 21);
this.comboSoundTime.TabIndex = 13;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F);
this.label1.Location = new System.Drawing.Point(3, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(127, 24);
this.label1.TabIndex = 14;
this.label1.Text = "Løbs nummer";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1104, 387);
this.Controls.Add(this.txtLog);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.grid)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.entryBindingSource)).EndInit();
this.txtLog.ResumeLayout(false);
this.txtLog.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView grid;
private System.Windows.Forms.BindingSource entryBindingSource;
private System.Windows.Forms.Button btnMoveUp;
private System.Windows.Forms.Button btnMoveDown;
private System.Windows.Forms.TextBox txtHeader;
private System.Windows.Forms.Button btnAutoStart;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Timer countdowntimer;
private System.Windows.Forms.TableLayoutPanel txtLog;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TextBox txtDebug;
private System.Windows.Forms.ComboBox comboComport;
private System.Windows.Forms.DataGridViewButtonColumn Complete;
private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewButtonColumn DNF;
private System.Windows.Forms.ComboBox comboSoundTime;
private System.Windows.Forms.Label label1;
}
}

177
Tidstagning/Form1.cs Normal file

@ -0,0 +1,177 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Tidstagning
{
public partial class Form1 : Form
{
BindingList<Entry> entries = new BindingList<Entry> {
};
ResultList liste;
Relay horn;
System.IO.StreamReader deltager_handle;
public Form1()
{
InitializeComponent();
deltager_handle = new System.IO.StreamReader("Deltager.txt");
string deltager;
while ((deltager = deltager_handle.ReadLine()) != null)
{
string[] dele = deltager.Split(',');
entries.Add(new Entry(dele[0],dele[1]));
}
liste = new ResultList("Resultat", txtDebug);
foreach(string port in Relay.GetPorts()) {
comboComport.Items.Add(port);
}
comboSoundTime.SelectedIndex = 0;
comboComport.SelectedIndex = 0;
}
private void Form1_Load(object sender, EventArgs e)
{
grid.DataSource = entries;
}
private void grid_Click(object sender, DataGridViewCellEventArgs e)
{
if (btnStop.Enabled != true)
return;
if (e.RowIndex >= 0 && e.ColumnIndex == grid.Columns["DNF"].Index)
{
entries[e.RowIndex].DNF();
liste.WriteDNF(entries[e.RowIndex]);
int index = e.RowIndex;
grid.ClearSelection();
grid.CurrentCell = null;
entries.RemoveAt(e.RowIndex);
}
if (e.RowIndex >= 0 && e.ColumnIndex == grid.Columns["Complete"].Index) {
entries[e.RowIndex].Complete();
liste.WriteComplete(entries[e.RowIndex]);
int index = e.RowIndex;
grid.ClearSelection();
grid.CurrentCell = null;
entries.RemoveAt(e.RowIndex);
horn.Set(0x00, 0x01);
countdowntimer.Interval = int.Parse(comboSoundTime.SelectedItem.ToString());
countdowntimer.Start();
}
//grid.
grid.Refresh();
}
private void btnMoveUp_Click(object sender, EventArgs e)
{
if (grid.SelectedRows.Count == 1)
{
int idx = grid.SelectedRows[0].Index;
if (idx == 0)
return;
Entry entry = entries[idx];
entries.Remove(entry);
entries.Insert(idx - 1, entry);
grid.ClearSelection();
grid.Rows[idx - 1].Selected = true;
}
}
private void btnMoveDown_Click(object sender, EventArgs e)
{
if (grid.SelectedRows.Count == 1)
{
int idx = grid.SelectedRows[0].Index;
if (idx == grid.Rows.Count - 1 )
return;
Entry entry = entries[idx];
entries.Remove(entry);
entries.Insert(idx + 1, entry);
grid.ClearSelection();
grid.Rows[idx + 1].Selected = true;
}
}
private void btnAutoStart_Click(object sender, EventArgs e)
{
if (txtHeader.Text == "")
return;
liste.WriteHeader(txtHeader.Text);
btnAutoStart.Enabled = false;
btnStop.Enabled = true;
horn = new Relay(comboComport.SelectedItem.ToString());
}
private void btnStop_Click(object sender, EventArgs e)
{
btnAutoStart.Enabled = true;
btnStop.Enabled = false;
horn.Close();
liste.Write("Nedtælling stoppet");
countdowntimer.Stop();
}
private void timer_Tick(object sender, EventArgs e)
{
countdowntimer.Stop();
horn.Set(0x00, 0x00);
}
//Enlarge the row in view
private void grid_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
MessageBox.Show(e.RowIndex.ToString());
//grid.Rows[e.RowIndex].Height = 40;
//grid.Refresh();
}
private void grid_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{
//grid.Rows[e.RowIndex].Height = 20;
//grid.Refresh();
}
}
}

135
Tidstagning/Form1.resx Normal file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Complete.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="DNF.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="entryBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="countdowntimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>165, 17</value>
</metadata>
<metadata name="comboComport.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

21
Tidstagning/Program.cs Normal file

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Tidstagning
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Tidstagning")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tidstagning")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1f547dc7-1ba1-4877-9e70-dc09cc1d3f64")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Entry" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Tidstagning.Entry, Tidstagning, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1022
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Tidstagning.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tidstagning.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1022
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Tidstagning.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

33
Tidstagning/Relay.cs Normal file

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Ports;
namespace Tidstagning
{
class Relay
{
SerialPort com;
public Relay(string ComPort)
{
com = new SerialPort();
com.PortName = ComPort;
com.BaudRate = 9600;
com.Open();
}
public void Set(int output, byte state) {
byte[] command = {0xff, 0x01, state};
com.Write(command, 0, 3);
}
public void Close() {
if(com.IsOpen)
com.Close();
}
public static string[] GetPorts()
{
return SerialPort.GetPortNames();
}
}
}

55
Tidstagning/ResultList.cs Normal file

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Tidstagning
{
class ResultList
{
System.IO.StreamWriter filehandle;
System.IO.StreamWriter filehandle2;
System.Windows.Forms.TextBox log;
string racenumber;
public ResultList(string filename, System.Windows.Forms.TextBox log_object)
{
filehandle = new System.IO.StreamWriter(filename +"_" + DateTime.Now.ToString("dd-MM-yyyy-hh-mm") + ".txt");
filehandle2 = new System.IO.StreamWriter(filename + "_" + DateTime.Now.ToString("dd-MM-yyyy-hh-mm") + ".csv");
log = log_object;
}
public void WriteHeader(string header) {
this.racenumber = header;
Write("----------------------------");
Write(header);
Write("Løb startet den: " + DateTime.Now.ToString());
Write("----------------------------");
WriteCSV("RaceNo,SailNo,Finish,Code,");
}
public void WriteComplete(Entry Boat) {
Write("Fuldført! - " + Boat.Name + " - " + Boat.Completed_Time.ToString());
WriteCSV(this.racenumber + "," +Boat.SailNumber + "," + Boat.Completed_Time.ToString("hh:mm:ss") + ", ,");
}
public void WriteDNF(Entry Boat) {
Write("Udgået! - " + Boat.Name + " - " + Boat.Completed_Time.ToString());
WriteCSV(this.racenumber + "," +Boat.SailNumber + "," + "00:00:00,DNC,");
}
public void Write(string textstring) {
filehandle.WriteLine(textstring);
log.AppendText(textstring + "\r\n");
filehandle.Flush();
}
public void WriteCSV(string textstring)
{
filehandle2.WriteLine(textstring);
filehandle2.Flush();
}
}
}

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DFE0844B-9986-4623-8188-7F4A828FBB02}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Tidstagning</RootNamespace>
<AssemblyName>Tidstagning</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>86AFBD08924E61031114EAB5B6DF6585A43E2B5F</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>Tidstagning_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Entry.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Relay.cs" />
<Compile Include="ResultList.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\DataSources\Entry.datasource" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory />
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>

3
Tidstagning/app.config Normal file

@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727" sku="Client"/></startup></configuration>