private void StartBT_Click(object sender, EventArgs e) { IsTracking = true; if (CurrentTD == null) { CurrentTD = new TrackDetail() { Project = ProjectTB.Text.Trim(), Start = DateTime.Now, End = DateTime.Now, Task = TaskTB.Text.Trim() }; using (var ctx = new TimeTrackerContext()) { ctx.TrackDetails.Add(CurrentTD); ctx.SaveChanges(); } } }
public Form1() { InitializeComponent(); IsTracking = false; CurrentTD = null; }