Persistent setting of comport and autostartprocedure
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
46
Tidstagning/Form1.Designer.cs
generated
46
Tidstagning/Form1.Designer.cs
generated
@ -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);
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
26
Tidstagning/Properties/Settings.Designer.cs
generated
26
Tidstagning/Properties/Settings.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,12 @@
|
||||
<?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>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Tidstagning.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="ComPort" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">N/A</Value>
|
||||
</Setting>
|
||||
<Setting Name="AutoStartProcedure" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
28
Tidstagning/Settings.cs
Normal file
28
Tidstagning/Settings.cs
Normal file
@ -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.
|
||||
}
|
||||
}
|
||||
}
|
@ -106,6 +106,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Relay.cs" />
|
||||
<Compile Include="ResultList.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
<EmbeddedResource Include="AboutBox.resx">
|
||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -1,3 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="Tidstagning.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup>
|
||||
<userSettings>
|
||||
<Tidstagning.Properties.Settings>
|
||||
<setting name="ComPort" serializeAs="String">
|
||||
<value>N/A</value>
|
||||
</setting>
|
||||
<setting name="AutoStartProcedure" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
</Tidstagning.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
|
Reference in New Issue
Block a user