/// <summary> /// Initializes a new incremental clock. /// </summary> /// <param name="startTime">Initial time for the clock.</param> /// <param name="addTime">time added for each move performed.</param> public IncrementalClock(TimeSpan startTime, TimeSpan addTime) { m_addTime = addTime; m_whiteTimer = new CountdownTimer(startTime); m_blackTimer = new CountdownTimer(startTime); m_whiteTimer.TimerNotify += WhiteClockEventHandler; m_blackTimer.TimerNotify += BlackClockEventHandler; m_currentState = new ClockState(startTime, startTime, true); m_undoHistory = new Stack<ClockState>(); m_redoHistory = new Stack<ClockState>(); }
/// <summary> /// Initializes a new conventional clock. /// </summary> /// <param name="moves">Moves that must be taken within the given time.</param> /// <param name="time">Time available to make the given amount of moves.</param> public ConventionalClock(int moves, TimeSpan time) { m_moves = moves; m_time = time; m_whiteMoves = moves; m_blackMoves = moves; m_whiteTimer = new CountdownTimer(time); m_blackTimer = new CountdownTimer(time); m_whiteTimer.TimerNotify += WhiteClockEventHandler; m_blackTimer.TimerNotify += BlackClockEventHandler; m_currentState = new ClockState(moves, moves, time, time, true); m_undoHistory = new Stack <ClockState>(); m_redoHistory = new Stack <ClockState>(); }
/// <summary> /// Initializes a new conventional clock. /// </summary> /// <param name="moves">Moves that must be taken within the given time.</param> /// <param name="time">Time available to make the given amount of moves.</param> public ConventionalClock(int moves, TimeSpan time) { m_moves = moves; m_time = time; m_whiteMoves = moves; m_blackMoves = moves; m_whiteTimer = new CountdownTimer(time); m_blackTimer = new CountdownTimer(time); m_whiteTimer.TimerNotify += WhiteClockEventHandler; m_blackTimer.TimerNotify += BlackClockEventHandler; m_currentState = new ClockState(moves, moves, time, time, true); m_undoHistory = new Stack<ClockState>(); m_redoHistory = new Stack<ClockState>(); }