Exemplo n.º 1
0
        public HueLightShow(ColorGeneratorBase colorGenerator, HueLighting lighting)
        {
            this.ColorGenerator = colorGenerator;
            this.Lighting = lighting;

            // Instead of having a special case for the lightshow loop before the first set of colors has been generated,
            // we provide initial dummy values.
            this.mostRecentGeneratedColors = new GeneratedColors()
            {
                Colors = Enumerable.Range(0, this.ColorGenerator.NumberOfColors).Select(i => new LightColor()).ToArray()
            };
        }
Exemplo n.º 2
0
        protected virtual void OnColorsGenerated(GeneratedColors generatedColors)
        {
            if (generatedColors.Colors.Length != this.NumberOfColors)
            {
                throw new ArgumentException("The number of generated colors must match NumberOfColors", "generatedColors");
            }

            var ev = this.ColorsGenerated;
            if (ev != null)
            {
                ev(this, generatedColors);
            }
        }
Exemplo n.º 3
0
 private void ColorGenerator_ColorsGenerated(object sender, GeneratedColors e)
 {
     this.mostRecentGeneratedColors = e;
 }