private void Reset() { Processes.Clear(); Breaks.Clear(); currentBreak = null; currentProcess = null; ElapsedTime = 0d; }
public void Pause() { if (SessionState == SessionStates.Active) { currentBreak = new BreakData(); OnStateChanged(SessionStates.Paused); } else { throw new InvalidOperationException("Can not pause in an inactive state"); } }
public void Resume() { if (SessionState == SessionStates.Paused) { currentBreak.EndBreak(); Breaks.Add(currentBreak); currentBreak = null; OnStateChanged(SessionStates.Active); } else { throw new InvalidOperationException("Can not resume from a non paused state"); } }
public void Stop() { if (SessionState == SessionStates.Active) { SessionStop = DateTime.UtcNow; OnStateChanged(SessionStates.Stopped); } else if (SessionState == SessionStates.Paused) { Breaks.Add(currentBreak); currentBreak = null; SessionStop = DateTime.UtcNow; OnStateChanged(SessionStates.Stopped); } }