示例#1
0
        public override string Print(BerlinClockModel clockModel)
        {
            var sb = new StringBuilder();

            foreach (var clockRow in ClockRows)
            {
                sb.AppendLine(clockRow(clockModel)
                              .GetRowData());
            }

            return(sb.ToString().TrimEnd());
        }
示例#2
0
        private string GenerateTimeToViewFormat(
            TimeSpan timeSpan,
            IBerlinClockViewFormat berlinClockViewFormat)
        {
            int hour    = this.CalculateHour(timeSpan);
            int minutes = timeSpan.Minutes;
            int seconds = timeSpan.Seconds;

            BerlinClockModel berlinClockModel = new BerlinClockModel(
                evenSeconds: seconds % 2 == 0,
                countOf5Hours: hour / 5,
                countOfModHours: hour % 5,
                countOf5Minutes: minutes / 5,
                countOfModMinutes: minutes % 5
                );

            return(berlinClockViewFormat.MakeView(berlinClockModel));
        }
 public abstract T Print(BerlinClockModel model);