worktimehero

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.clttr.info/worktimehero.git
Log | Files | Refs | README | LICENSE

commit aa7a3e24985e6fa043cae6ba8348bea823bb8220
parent e32b4d6c455f2b0fc7b5377013ef3d47f2b63ecc
Author: René Wagner <rwagner@rw-net.de>
Date:   Tue, 26 May 2020 16:24:50 +0200

~rwa/misc#30: safe individual break time for today

Safe individual break time if it has already been set for today
to survive app restart.

Diffstat:
MWorkTimeHero/App.config | 3+++
MWorkTimeHero/MainForm.cs | 10++++++++--
MWorkTimeHero/Properties/AssemblyInfo.cs | 4++--
MWorkTimeHero/Properties/Settings.Designer.cs | 12++++++++++++
MWorkTimeHero/Properties/Settings.settings | 3+++
5 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/WorkTimeHero/App.config b/WorkTimeHero/App.config @@ -19,6 +19,9 @@ <setting name="StartTimestamp" serializeAs="String"> <value>1970-01-01</value> </setting> + <setting name="IndividualBreakTime" serializeAs="String"> + <value>1970-01-01</value> + </setting> </WorkTimeHero.Properties.Settings> </userSettings> </configuration> \ No newline at end of file diff --git a/WorkTimeHero/MainForm.cs b/WorkTimeHero/MainForm.cs @@ -28,8 +28,6 @@ namespace WorkTimeHero private void MainForm_Load(object sender, EventArgs e) { - //ttings.Default.Upgrade(); - if (Settings.Default.StartTimestamp.Date.Equals(DateTime.Now.Date)) { dtpStartTime.Value = Settings.Default.StartTimestamp; @@ -42,6 +40,12 @@ namespace WorkTimeHero Settings.Default.Save(); } + if (Settings.Default.IndividualBreakTime.Date.Equals(DateTime.Now.Date)) + { + cboIndividualBreak.Checked = true; + dtpBreak.Value = Settings.Default.IndividualBreakTime; + } + if (File.Exists(startUpFolderPathLink)) { cboAutostart.Checked = true; @@ -143,6 +147,7 @@ namespace WorkTimeHero private void cboIndividualBreak_CheckedChanged(object sender, EventArgs e) { dtpBreak.Enabled = cboIndividualBreak.Checked; + if (!dtpBreak.Value.Date.Equals(DateTime.Now.Date)) { dtpBreak.Value = DateTime.Now.Date.AddMinutes(45); } RefreshWtc(); } @@ -198,6 +203,7 @@ namespace WorkTimeHero private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { Settings.Default.StartTimestamp = dtpStartTime.Value; + if (cboIndividualBreak.Checked) { Settings.Default.IndividualBreakTime = dtpBreak.Value; } Settings.Default.Save(); } diff --git a/WorkTimeHero/Properties/AssemblyInfo.cs b/WorkTimeHero/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 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.4.1.0")] -[assembly: AssemblyFileVersion("1.4.1.0")] +[assembly: AssemblyVersion("1.4.2.0")] +[assembly: AssemblyFileVersion("1.4.2.0")] diff --git a/WorkTimeHero/Properties/Settings.Designer.cs b/WorkTimeHero/Properties/Settings.Designer.cs @@ -58,5 +58,17 @@ namespace WorkTimeHero.Properties { this["StartTimestamp"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("1970-01-01")] + public global::System.DateTime IndividualBreakTime { + get { + return ((global::System.DateTime)(this["IndividualBreakTime"])); + } + set { + this["IndividualBreakTime"] = value; + } + } } } diff --git a/WorkTimeHero/Properties/Settings.settings b/WorkTimeHero/Properties/Settings.settings @@ -11,5 +11,8 @@ <Setting Name="StartTimestamp" Type="System.DateTime" Scope="User"> <Value Profile="(Default)">1970-01-01</Value> </Setting> + <Setting Name="IndividualBreakTime" Type="System.DateTime" Scope="User"> + <Value Profile="(Default)">1970-01-01</Value> + </Setting> </Settings> </SettingsFile> \ No newline at end of file