示例#1
0
 internal LightCollection(LifxClient client, string id, string label, List <Light> lights)
 {
     this.client = client;
     Id          = id;
     Label       = label;
     this.lights = lights;
 }
示例#2
0
        public static List <Location> AsLocations(this IEnumerable <Light> lights)
        {
            Dictionary <Light.CollectionSpec, List <Light> > groups =
                new Dictionary <Light.CollectionSpec, List <Light> >();

            foreach (Light light in lights)
            {
                if (!groups.ContainsKey(light.location))
                {
                    groups[light.location] = new List <Light>();
                }
                groups[light.location].Add(light);
            }
            // Grab client from a light
            LifxClient client = (groups.Count > 0) ? groups.First().Value.First().Client : null;

            return(groups.Select(entry => new Location(client, entry.Key.id, entry.Key.name, entry.Value)).ToList());
        }
示例#3
0
 public Group(LifxClient client, string id, string label, List <Light> lights)
     : base(client, id, label, lights)
 {
 }
示例#4
0
 public Location(LifxClient client, string id, string label, List <Light> lights)
     : base(client, id, label, lights)
 {
 }