diff --git a/Tidstagning/Form1.Designer.cs b/Tidstagning/Form1.Designer.cs index a3815de..3dc1667 100644 --- a/Tidstagning/Form1.Designer.cs +++ b/Tidstagning/Form1.Designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.btnTest = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); @@ -42,7 +42,9 @@ 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(); @@ -50,13 +52,11 @@ this.comboComport = new System.Windows.Forms.ComboBox(); this.lblClock = new System.Windows.Forms.Label(); this.Clock = new System.Windows.Forms.Timer(this.components); - this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.entryBindingSource = new System.Windows.Forms.BindingSource(this.components); 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(); // // btnTest @@ -89,7 +89,7 @@ this.txtDebug.Name = "txtDebug"; this.txtDebug.ReadOnly = true; this.txtDebug.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtDebug.Size = new System.Drawing.Size(707, 134); + this.txtDebug.Size = new System.Drawing.Size(559, 134); this.txtDebug.TabIndex = 10; // // panel1 @@ -174,8 +174,8 @@ this.grid.Name = "grid"; this.grid.ReadOnly = true; this.grid.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; - dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F); - this.grid.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F); + this.grid.RowsDefaultCellStyle = dataGridViewCellStyle1; this.txtLog.SetRowSpan(this.grid, 2); this.grid.RowTemplate.Height = 30; this.grid.Size = new System.Drawing.Size(1059, 548); @@ -192,6 +192,13 @@ 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"; @@ -200,12 +207,16 @@ this.DNF.Text = "Udgået"; this.DNF.UseColumnTextForButtonValue = true; // + // entryBindingSource + // + this.entryBindingSource.DataSource = typeof(Tidstagning.Entry); + // // txtLog // this.txtLog.ColumnCount = 3; this.txtLog.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F)); 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, 352F)); + this.txtLog.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 500F)); this.txtLog.Controls.Add(this.grid, 1, 0); this.txtLog.Controls.Add(this.txtHeader, 0, 0); this.txtLog.Controls.Add(this.txtDebug, 1, 2); @@ -278,10 +289,10 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblClock.AutoSize = true; - this.lblClock.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblClock.Location = new System.Drawing.Point(966, 554); + this.lblClock.Font = new System.Drawing.Font("Microsoft Sans Serif", 72F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblClock.Location = new System.Drawing.Point(818, 554); this.lblClock.Name = "lblClock"; - this.lblClock.Size = new System.Drawing.Size(346, 140); + this.lblClock.Size = new System.Drawing.Size(494, 140); this.lblClock.TabIndex = 16; this.lblClock.Text = "--:--:--"; this.lblClock.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -291,17 +302,6 @@ this.Clock.Enabled = true; this.Clock.Tick += new System.EventHandler(this.Clock_Tick); // - // 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); @@ -318,11 +318,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); } diff --git a/Tidstagning/Form1.cs b/Tidstagning/Form1.cs index 86f1f09..abb48d1 100644 --- a/Tidstagning/Form1.cs +++ b/Tidstagning/Form1.cs @@ -33,7 +33,18 @@ namespace Tidstagning comboComport.Items.Add(port); } - comboComport.SelectedIndex = 0; + checkStartProcedure.Checked = Properties.Settings.Default.AutoStartProcedure; + + string comport = Properties.Settings.Default.ComPort; + int index = comboComport.Items.IndexOf(comport); + if (index == -1) + { + comboComport.SelectedIndex = 0; + } + else + { + comboComport.SelectedIndex = index; + } } @@ -115,11 +126,9 @@ namespace Tidstagning liste.WriteFooter(); liste.Close(); checkStartProcedure.Enabled = true; - checkStartProcedure.Checked = false; comboComport.Enabled = true; comboSoundTime.Enabled = true; startprocedure.Clear(); - } private void grid_MouseMove(object sender, MouseEventArgs e) @@ -166,6 +175,8 @@ namespace Tidstagning if (comboComport.Items.Count != 0) { horn = new Relay(comboComport.SelectedItem.ToString()); + Properties.Settings.Default.ComPort = comboComport.SelectedItem.ToString(); + Properties.Settings.Default.Save(); } } @@ -176,6 +187,9 @@ namespace Tidstagning { startprocedure.ReadFile(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/Tidstagning/" + "Startprocedure.txt"); } + + Properties.Settings.Default.AutoStartProcedure = checkStartProcedure.Checked; + Properties.Settings.Default.Save(); } } } diff --git a/Tidstagning/Properties/Settings.Designer.cs b/Tidstagning/Properties/Settings.Designer.cs index b5182d2..7fdedd4 100644 --- a/Tidstagning/Properties/Settings.Designer.cs +++ b/Tidstagning/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace Tidstagning.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.6.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -22,5 +22,29 @@ namespace Tidstagning.Properties { return defaultInstance; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("N/A")] + public string ComPort { + get { + return ((string)(this["ComPort"])); + } + set { + this["ComPort"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool AutoStartProcedure { + get { + return ((bool)(this["AutoStartProcedure"])); + } + set { + this["AutoStartProcedure"] = value; + } + } } } diff --git a/Tidstagning/Properties/Settings.settings b/Tidstagning/Properties/Settings.settings index 3964565..276cee6 100644 --- a/Tidstagning/Properties/Settings.settings +++ b/Tidstagning/Properties/Settings.settings @@ -1,7 +1,12 @@  - - - - - - + + + + + N/A + + + False + + + \ No newline at end of file diff --git a/Tidstagning/Settings.cs b/Tidstagning/Settings.cs new file mode 100644 index 0000000..c33543e --- /dev/null +++ b/Tidstagning/Settings.cs @@ -0,0 +1,28 @@ +namespace Tidstagning.Properties { + + + // This class allows you to handle specific events on the settings class: + // The SettingChanging event is raised before a setting's value is changed. + // The PropertyChanged event is raised after a setting's value is changed. + // The SettingsLoaded event is raised after the setting values are loaded. + // The SettingsSaving event is raised before the setting values are saved. + internal sealed partial class Settings { + + public Settings() { + // // To add event handlers for saving and changing settings, uncomment the lines below: + // + // this.SettingChanging += this.SettingChangingEventHandler; + // + // this.SettingsSaving += this.SettingsSavingEventHandler; + // + } + + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { + // Add code to handle the SettingChangingEvent event here. + } + + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { + // Add code to handle the SettingsSaving event here. + } + } +} diff --git a/Tidstagning/Tidstagning.csproj b/Tidstagning/Tidstagning.csproj index 46462b2..c895d7e 100644 --- a/Tidstagning/Tidstagning.csproj +++ b/Tidstagning/Tidstagning.csproj @@ -106,6 +106,7 @@ + AboutBox.cs diff --git a/Tidstagning/app.config b/Tidstagning/app.config index 5c22b42..a978df3 100644 --- a/Tidstagning/app.config +++ b/Tidstagning/app.config @@ -1,3 +1,19 @@ - + + +
+ + + + + + + N/A + + + False + + + +