Пример #1
0
        string GetRowWithLamps(int count, int totalLampsInRow, LampState lampOnState, IRowConverter rowConverter = null)
        {
            Debug.Assert(count <= totalLampsInRow);
            Debug.Assert(lampOnState != LampState.Off);

            var row = new string((char)lampOnState, count);

            if (rowConverter != null)
            {
                row = rowConverter.Convert(row);
            }

            row = row.PadRight(totalLampsInRow, (char)LampState.Off);
            return(row);
        }
Пример #2
0
 public Lamp(Color color, LampState initialState = LampState.Off)
 {
     Color = color;
     State = initialState;
 }
Пример #3
0
 internal void SwitchOff() => State = LampState.Off;
Пример #4
0
 internal void SwitchOn() => State = LampState.On;