Пример #1
0
 /// <summary>
 /// Creates the LED resources for the controller having the passed <see cref="Controller.Id"/>.
 /// </summary>
 /// <param name="controllerId">the <see cref="Controller.Id"/> of the controller</param>
 /// <param name="ledCount">number of LEDs to be created</param>
 private void CreateLeds(int controllerId, int ledCount)
 {
     //create LEDs
     for (int i = 0; i < ledCount; i++)
     {
         _ledStorage.AddLed(controllerId, i);
     }
 }
        /// <summary>
        /// Initializes an instance of this class and creates all <see cref="Led"/> resources in the non-persistent <see cref="ILedStorage"/>.
        /// </summary>
        /// <param name="ledStorage">reference to the <see cref="ILedStorage"/>  where all groups are stored</param>
        /// <param name="controllerStorage">reference to the <see cref="IGroupStorage"/> where all controllers are stored</param>
        public LedHandler(ILedStorage ledStorage, IControllerStorage controllerStorage)
        {
            _ledStorage = ledStorage;

            foreach (IControllerDataSet cds in controllerStorage.GetAllControllers())
            {
                for (int i = 0; i < cds.LedCount; i++)
                {
                    _ledStorage.AddLed(cds.Id, i);
                }
            }
        }