public static Task <LifxCloudClient> CreateAsync(string appToken)
        {
            LifxCloudClient client = new LifxCloudClient();

            client.Initialize(appToken);
            return(Task.FromResult(client));
        }
Esempio n. 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
            LifxCloudClient 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());
        }