Skip to content

Commit

Permalink
fixes #24 error with working comments on active task
Browse files Browse the repository at this point in the history
  • Loading branch information
bethune-bryant committed Jan 26, 2018
1 parent 1a99e37 commit 9cbd6e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
7 changes: 5 additions & 2 deletions TimeKeeper/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,11 @@ private void timerWorking_Tick(object sender, EventArgs e)
}
else
{
Settings.CurrentSettings.LastUnclosedTask.Comments = (Settings.CurrentSettings.LastUnclosedTask.Comments + Environment.NewLine + stillWorking.Comment).Trim();
RefreshEntries();
if (Settings.CurrentSettings.LastUnclosedTask != null)
{
Settings.CurrentSettings.LastUnclosedTask.Comments = (Settings.CurrentSettings.LastUnclosedTask.Comments + Environment.NewLine + stillWorking.Comment).Trim();
RefreshEntries();
}
}

timerWorking.Interval = Settings.CurrentSettings.StillWorkingTime * 60 * 1000;
Expand Down
18 changes: 17 additions & 1 deletion TimeKeeper/frmWorking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ private void frmWorking_Load(object sender, EventArgs e)
this.Text = "Still not working";
this.radioNo.Visible = false;
this.radioNo.Enabled = false;
this.AllowComment = false;
}
else
{
this.radioYes.Text = "Yes, I'm still working on \"" + Settings.CurrentSettings.LastUnclosedTask.ToString() + "\"";
this.AllowComment = true;
}

comboNew.Items.Add("New Task");
Expand All @@ -51,6 +53,20 @@ public bool FinishedWorking
}
}

private bool allowComment;
public bool AllowComment
{
get
{
return allowComment;
}
set
{
allowComment = value;
txtComment.Enabled = radioYes.Checked && AllowComment;
}
}

public TimeEntry NewTask
{
get
Expand Down Expand Up @@ -123,7 +139,7 @@ private void all_KeyUp(object sender, KeyEventArgs e)

private void radioYes_CheckedChanged(object sender, EventArgs e)
{
txtComment.Enabled = radioYes.Checked;
txtComment.Enabled = radioYes.Checked && AllowComment;
}
}
}

0 comments on commit 9cbd6e1

Please sign in to comment.