private void ForegroundChanged(string name) { if (stopwatch.Running == true) { stopwatch.Pause(); var entity = new Session(); entity.stopDate = DateTime.Now; entity.timeSpanTicks = stopwatch.programElapsed.Ticks; entity.programName = programName; entity.category = selectedCategory; sessions.Add(entity); stopwatch.ResetProgramElapsed(); stopwatch.Start(); ActiveWindowLabel.Invoke((MethodInvoker) delegate { ActiveWindowLabel.Text = programName; }); } programName = name; }
private void ForegroundChanged(string name) { programName = name; if (stopwatch.Running == true) { stopwatch.Pause(); var entity = new Entity(); entity.stopDate = DateTime.Now; entity.timeSpanTicks = stopwatch.programElapsed.Ticks / 10000000; entity.programName = name; entities.Add(entity); stopwatch.ResetProgramElapsed(); stopwatch.Start(); ActiveWindowLabel.Invoke((MethodInvoker) delegate { ActiveWindowLabel.Text = programName; }); } }