示例#1
0
 private void SetColor(IEnumerable <int> deviceIds, BlyncClient.Color color)
 {
     foreach (var deviceId in deviceIds)
     {
         _blyncClient.SetColor(deviceId, color);
     }
 }
示例#2
0
 private void When_I_turn_on_predefined_color(BlyncClient.Color color)
 {
     _successful = true;
     for (var device = 0; device < _blyncClient.NumberOfDevices; device++)
     {
         _successful &= _blyncClient.SetColor(device, color);
     }
 }
示例#3
0
        private static void Main(string[] args)
        {
            int i = 120;

            if (args.Length == 1)
            {
                i = int.Parse(args[0]);
            }
            var client = new BlyncClient();

            var hsvColor = new HsvColor
            {
                Hue        = 1,
                Saturation = 1,
                Value      = 1
            };

            while (true)
            {
                var rgbColor = hsvColor.ToRgbColor();
                client.SetColor(0, rgbColor.Red, rgbColor.Green, rgbColor.Blue);

                hsvColor.Hue++;
                if (hsvColor.Hue > 360)
                {
                    hsvColor.Hue = 1;
                }

                Thread.Sleep((i * 1000) / 360);
            }
        }
示例#4
0
        private void When_I_cycle_through_all_colors()
        {
            _successful = true;

            for (var red = 0; red < MaxIntensity; red += IntensityStep)
            {
                for (var green = 0; green < MaxIntensity; green += IntensityStep)
                {
                    for (var blue = 0; blue < MaxIntensity; blue += IntensityStep)
                    {
                        for (var device = 0; device < _blyncClient.NumberOfDevices; device++)
                        {
                            _successful &= _blyncClient.SetColor(device, red, green, blue);
                        }
                    }
                }
            }
        }
示例#5
0
        private void ProcessColor(BlyncClient blyncClient, Options options)
        {
            BlyncClient.Color color;
            switch (options.Color.ToLower())
            {
            case "red":
                color = BlyncClient.Color.Red;
                break;

            case "green":
                color = BlyncClient.Color.Green;
                break;

            case "blue":
                color = BlyncClient.Color.Blue;
                break;

            case "cyan":
                color = BlyncClient.Color.Cyan;
                break;

            case "magenta":
                color = BlyncClient.Color.Magenta;
                break;

            case "yellow":
                color = BlyncClient.Color.Yellow;
                break;

            case "white":
                color = BlyncClient.Color.White;
                break;

            case "orange":
                color = BlyncClient.Color.Orange;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            foreach (var device in options.Device)
            {
                blyncClient.SetColor(Int32.Parse(device), color);
            }
        }