Beispiel #1
0
 private void Reset()
 {
     Processes.Clear();
     Breaks.Clear();
     currentBreak   = null;
     currentProcess = null;
     ElapsedTime    = 0d;
 }
Beispiel #2
0
 public void Pause()
 {
     if (SessionState == SessionStates.Active)
     {
         currentBreak = new BreakData();
         OnStateChanged(SessionStates.Paused);
     }
     else
     {
         throw new InvalidOperationException("Can not pause in an inactive state");
     }
 }
Beispiel #3
0
 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");
     }
 }
Beispiel #4
0
 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);
     }
 }