worktimehero

git clone https://git.clttr.info/worktimehero.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 8bec28576e72cafb06dce087feda41032c3399b6
parent 204d3ac40e2b0c24cad417d8a9d09dba1915b5f6
Author: René Wagner <rwagner@rw-net.de>
Date:   Wed, 18 Nov 2020 13:00:37 +0100

show netto time of last day

Diffstat:
MWorkTimeHero/App.config | 3+++
MWorkTimeHero/MainForm.Designer.cs | 28++++++++++++++--------------
MWorkTimeHero/MainForm.cs | 19+++++++++++++++----
MWorkTimeHero/Properties/Settings.Designer.cs | 14+++++++++++++-
MWorkTimeHero/Properties/Settings.settings | 3+++
5 files changed, 48 insertions(+), 19 deletions(-)

diff --git a/WorkTimeHero/App.config b/WorkTimeHero/App.config @@ -25,6 +25,9 @@ <setting name="CurrentBreakStartTime" serializeAs="String"> <value>00:00:00</value> </setting> + <setting name="PreDayWorkTime" serializeAs="String"> + <value>2020-11-18</value> + </setting> </WorkTimeHero.Properties.Settings> </userSettings> </configuration> diff --git a/WorkTimeHero/MainForm.Designer.cs b/WorkTimeHero/MainForm.Designer.cs @@ -37,7 +37,6 @@ this.lblCompleted = new System.Windows.Forms.Label(); this.refreshTimer = new System.Windows.Forms.Timer(this.components); this.lblRemaining = new System.Windows.Forms.Label(); - this.lblOvertime = new System.Windows.Forms.Label(); this.lblTimeDue = new System.Windows.Forms.Label(); this.cboIndividualBreak = new System.Windows.Forms.CheckBox(); this.ntiWorkTimeHero = new System.Windows.Forms.NotifyIcon(this.components); @@ -54,6 +53,7 @@ this.nudPreamp = new System.Windows.Forms.NumericUpDown(); this.lblCurrentBreak = new System.Windows.Forms.Label(); this.btnSwitchBreak = new System.Windows.Forms.Button(); + this.lblPreDay = new System.Windows.Forms.Label(); this.cmsNotifyIcon.SuspendLayout(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudPreamp)).BeginInit(); @@ -128,22 +128,12 @@ this.lblRemaining.TabIndex = 2; this.lblRemaining.Text = "Verbleibend"; // - // lblOvertime - // - this.lblOvertime.AutoSize = true; - this.lblOvertime.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblOvertime.Location = new System.Drawing.Point(223, 9); - this.lblOvertime.Name = "lblOvertime"; - this.lblOvertime.Size = new System.Drawing.Size(84, 15); - this.lblOvertime.TabIndex = 1; - this.lblOvertime.Text = "Überstunden"; - // // lblTimeDue // this.lblTimeDue.AutoSize = true; this.lblTimeDue.BackColor = System.Drawing.Color.Yellow; this.lblTimeDue.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblTimeDue.Location = new System.Drawing.Point(223, 31); + this.lblTimeDue.Location = new System.Drawing.Point(223, 9); this.lblTimeDue.Name = "lblTimeDue"; this.lblTimeDue.Size = new System.Drawing.Size(105, 15); this.lblTimeDue.TabIndex = 3; @@ -311,6 +301,16 @@ this.btnSwitchBreak.UseVisualStyleBackColor = true; this.btnSwitchBreak.Click += new System.EventHandler(this.btnSwitchBreak_Click); // + // lblPreDay + // + this.lblPreDay.AutoSize = true; + this.lblPreDay.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblPreDay.Location = new System.Drawing.Point(223, 31); + this.lblPreDay.Name = "lblPreDay"; + this.lblPreDay.Size = new System.Drawing.Size(49, 15); + this.lblPreDay.TabIndex = 1; + this.lblPreDay.Text = "Vortag"; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -322,7 +322,7 @@ this.Controls.Add(this.groupBox1); this.Controls.Add(this.cboIndividualBreak); this.Controls.Add(this.lblTimeDue); - this.Controls.Add(this.lblOvertime); + this.Controls.Add(this.lblPreDay); this.Controls.Add(this.lblRemaining); this.Controls.Add(this.lblCompleted); this.Controls.Add(this.prgPercentage); @@ -358,7 +358,6 @@ private System.Windows.Forms.Label lblCompleted; private System.Windows.Forms.Timer refreshTimer; private System.Windows.Forms.Label lblRemaining; - private System.Windows.Forms.Label lblOvertime; private System.Windows.Forms.Label lblTimeDue; private System.Windows.Forms.CheckBox cboIndividualBreak; private System.Windows.Forms.NotifyIcon ntiWorkTimeHero; @@ -375,6 +374,7 @@ private System.Windows.Forms.Label lblCurrentBreak; private System.Windows.Forms.Button btnSwitchBreak; private System.Windows.Forms.Button btnInfo; + private System.Windows.Forms.Label lblPreDay; } } diff --git a/WorkTimeHero/MainForm.cs b/WorkTimeHero/MainForm.cs @@ -20,6 +20,8 @@ namespace WorkTimeHero private readonly string startUpFolderPathLink = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Application.ProductName + ".lnk"); + private DateTime preDayWorkTime; + private Boolean initialize = true; private WorkTimeCalculator wtc; @@ -43,6 +45,7 @@ namespace WorkTimeHero dtpIndividualBreak.Value = DateTime.Now.Date.Add(wtc.PlannedBreakTime); dtpTargetTime.Value = DateTime.Now.Date.Add(Settings.Default.TargetTime); dtpStartTime.Value = DateTime.Now.Date.Add(startTime.TimeOfDay); + preDayWorkTime = Settings.Default.PreDayWorkTime; RefreshDisplay(); if (File.Exists(startUpFolderPathLink)) @@ -57,10 +60,17 @@ namespace WorkTimeHero { prgPercentage.Value = wtc.WorkTimePercentage; lblCompleted.Text = string.Format("{1,-20}{0}", wtc.DoneWorkTime.ToString(TimeFormatter), "Arbeitszeit:"); - lblOvertime.Text = string.Format("{1,-20}{0}", wtc.AdditionalWorkTime.ToString(TimeFormatter), "Überstunden:"); - lblRemaining.Text = string.Format("{1,-20}{0}", wtc.RemainingWorkTime.ToString(TimeFormatter), "verbleibende Zeit:"); - lblTimeDue.Text = string.Format("{1,-20}{0}", wtc.TimeDue.ToString(TimeFormatter), "Arbeitsende um:"); - + lblTimeDue.Text = string.Format("{1,-20}{0} Uhr", wtc.TimeDue.ToString(TimeFormatter), "Arbeitsende:"); + if (wtc.AdditionalWorkTime > new TimeSpan()) + { + lblRemaining.Text = string.Format("{1,-20}{0}", wtc.AdditionalWorkTime.ToString(TimeFormatter), "Überstunden:"); + } + else + { + lblRemaining.Text = string.Format("{1,-20}{0}", wtc.RemainingWorkTime.ToString(TimeFormatter), "Verbleibend:"); + } + lblPreDay.Text = string.Format("{1,-20}{0}", preDayWorkTime.ToString(TimeFormatter), "Nettozeit " + preDayWorkTime.ToString("d.M.")); + if (wtc.IndividualBreakTime.Date == DateTime.Now.Date) { dtpIndividualBreak.Value = wtc.IndividualBreakTime; @@ -235,6 +245,7 @@ namespace WorkTimeHero if (cboIndividualBreak.Checked) { Settings.Default.IndividualBreakTime = wtc.IndividualBreakTime; } Settings.Default.CurrentBreakStartTime = wtc.CurrentBreakStartTime; Settings.Default.TargetTime = wtc.TargetTime; + Settings.Default.PreDayWorkTime = DateTime.Now.Date.Add(wtc.DoneWorkTime); Settings.Default.Save(); } diff --git a/WorkTimeHero/Properties/Settings.Designer.cs b/WorkTimeHero/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace WorkTimeHero.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()))); @@ -82,5 +82,17 @@ namespace WorkTimeHero.Properties { this["CurrentBreakStartTime"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("2020-11-18")] + public global::System.DateTime PreDayWorkTime { + get { + return ((global::System.DateTime)(this["PreDayWorkTime"])); + } + set { + this["PreDayWorkTime"] = value; + } + } } } diff --git a/WorkTimeHero/Properties/Settings.settings b/WorkTimeHero/Properties/Settings.settings @@ -17,5 +17,8 @@ <Setting Name="CurrentBreakStartTime" Type="System.TimeSpan" Scope="User"> <Value Profile="(Default)">00:00:00</Value> </Setting> + <Setting Name="PreDayWorkTime" Type="System.DateTime" Scope="User"> + <Value Profile="(Default)">2020-11-18</Value> + </Setting> </Settings> </SettingsFile> \ No newline at end of file