commit 1e288d97f71d708f008b0f18f29d7ed4d8d75735 Author: Jens True Date: Tue Apr 21 17:47:38 2020 +0200 Initial import diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..360ea12 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vs diff --git a/Tidstagning.sln b/Tidstagning.sln new file mode 100644 index 0000000..9ecfd43 --- /dev/null +++ b/Tidstagning.sln @@ -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 diff --git a/Tidstagning.suo b/Tidstagning.suo new file mode 100644 index 0000000..0c4797a Binary files /dev/null and b/Tidstagning.suo differ diff --git a/Tidstagning/Deltager.txt b/Tidstagning/Deltager.txt new file mode 100644 index 0000000..a9babac --- /dev/null +++ b/Tidstagning/Deltager.txt @@ -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 diff --git a/Tidstagning/Entry.cs b/Tidstagning/Entry.cs new file mode 100644 index 0000000..07f677c --- /dev/null +++ b/Tidstagning/Entry.cs @@ -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; + } + } +} diff --git a/Tidstagning/Form1.Designer.cs b/Tidstagning/Form1.Designer.cs new file mode 100644 index 0000000..af49a29 --- /dev/null +++ b/Tidstagning/Form1.Designer.cs @@ -0,0 +1,296 @@ +namespace Tidstagning +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + + } +} + diff --git a/Tidstagning/Form1.cs b/Tidstagning/Form1.cs new file mode 100644 index 0000000..1c6f4e5 --- /dev/null +++ b/Tidstagning/Form1.cs @@ -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 entries = new BindingList { + + }; + 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(); + + } + + + + } +} diff --git a/Tidstagning/Form1.resx b/Tidstagning/Form1.resx new file mode 100644 index 0000000..c0acb13 --- /dev/null +++ b/Tidstagning/Form1.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + 17, 17 + + + 165, 17 + + + True + + \ No newline at end of file diff --git a/Tidstagning/Program.cs b/Tidstagning/Program.cs new file mode 100644 index 0000000..fffe908 --- /dev/null +++ b/Tidstagning/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace Tidstagning +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Tidstagning/Properties/AssemblyInfo.cs b/Tidstagning/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a858216 --- /dev/null +++ b/Tidstagning/Properties/AssemblyInfo.cs @@ -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")] diff --git a/Tidstagning/Properties/DataSources/Entry.datasource b/Tidstagning/Properties/DataSources/Entry.datasource new file mode 100644 index 0000000..702b2be --- /dev/null +++ b/Tidstagning/Properties/DataSources/Entry.datasource @@ -0,0 +1,10 @@ + + + + Tidstagning.Entry, Tidstagning, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/Tidstagning/Properties/Resources.Designer.cs b/Tidstagning/Properties/Resources.Designer.cs new file mode 100644 index 0000000..3679986 --- /dev/null +++ b/Tidstagning/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace Tidstagning.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Tidstagning/Properties/Resources.resx b/Tidstagning/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Tidstagning/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Tidstagning/Properties/Settings.Designer.cs b/Tidstagning/Properties/Settings.Designer.cs new file mode 100644 index 0000000..0247314 --- /dev/null +++ b/Tidstagning/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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; + } + } + } +} diff --git a/Tidstagning/Properties/Settings.settings b/Tidstagning/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Tidstagning/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Tidstagning/Relay.cs b/Tidstagning/Relay.cs new file mode 100644 index 0000000..4d88058 --- /dev/null +++ b/Tidstagning/Relay.cs @@ -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(); + } + } +} diff --git a/Tidstagning/ResultList.cs b/Tidstagning/ResultList.cs new file mode 100644 index 0000000..1883912 --- /dev/null +++ b/Tidstagning/ResultList.cs @@ -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(); + } + + } +} diff --git a/Tidstagning/Tidstagning.csproj b/Tidstagning/Tidstagning.csproj new file mode 100644 index 0000000..04e785d --- /dev/null +++ b/Tidstagning/Tidstagning.csproj @@ -0,0 +1,142 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {DFE0844B-9986-4623-8188-7F4A828FBB02} + WinExe + Properties + Tidstagning + Tidstagning + v3.5 + Client + 512 + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 1 + 1.0.0.%2a + false + true + true + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + 86AFBD08924E61031114EAB5B6DF6585A43E2B5F + + + Tidstagning_TemporaryKey.pfx + + + true + + + false + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + False + Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 3.1 + true + + + + + \ No newline at end of file diff --git a/Tidstagning/Tidstagning.csproj.user b/Tidstagning/Tidstagning.csproj.user new file mode 100644 index 0000000..6f23531 --- /dev/null +++ b/Tidstagning/Tidstagning.csproj.user @@ -0,0 +1,13 @@ + + + + + + + + + + en-US + false + + \ No newline at end of file diff --git a/Tidstagning/app.config b/Tidstagning/app.config new file mode 100644 index 0000000..e91dbe0 --- /dev/null +++ b/Tidstagning/app.config @@ -0,0 +1,3 @@ + + +