コード例 #1
0
        /// <summary>
        /// Create a lamp from the received message,
        /// and continue to request the next lamp untill there is no more lamps not requested.
        /// </summary>
        /// <param name="message"></param>
        public async void GetLampData(dynamic message)
        {
            Debug.WriteLine($"Received lamp data: {message}");

            var lamp = HueLamp.ParseLamp(message, this, LampIndex);

            if (lamp == null)
            {
                LampIndex = 1;
                return;
            }
            Lamps.Add(lamp);

            LampIndex++;
            await Connection.Connection.GetAsync($"{Ip}/api/{Username}/lights/{LampIndex}", GetLampData);

            Debug.WriteLine($"Lamps: {Lamps.Count}");
        }
コード例 #2
0
 public MinutesClockRows(bool secondRow)
 {
     if (!secondRow)
     {
         for (int i = 0; i < 11; i++)
         {
             if (i == 2 || i == 5 || i == 8)
             {
                 Lamps.Add(new ClockLampRedLamp(5));
             }
             else
             {
                 Lamps.Add(new ClockYellowLamp(5));
             }
         }
     }
     else
     {
         AddLamps <ClockYellowLamp>(1, 4);
     }
 }