Example #1
0
    internal Bridge(BridgeBridge bridge)
    {
      if (bridge == null)
        throw new ArgumentNullException ("bridge");

      Config = bridge.config;
      foreach (var light in bridge.lights)
        light.Value.Id = light.Key;
      Lights = bridge.lights.Select(l => l.Value).ToList();
    }
Example #2
0
        /// <summary>
        /// Get bridge info
        /// </summary>
        /// <returns></returns>
        public async Task <Bridge> GetBridgeAsync()
        {
            CheckInitialized();

            HttpClient client       = new HttpClient();
            var        stringResult = await client.GetStringAsync(new Uri(ApiBase)).ConfigureAwait(false);

            BridgeBridge jsonResult = JsonConvert.DeserializeObject <BridgeBridge>(stringResult);

            return(new Bridge(jsonResult));
        }
Example #3
0
        internal Bridge(BridgeBridge bridge)
        {
            if (bridge == null)
            {
                throw new ArgumentNullException("bridge");
            }

            Config = bridge.config;

            foreach (var light in bridge.lights)
            {
                light.Value.Id = light.Key;
            }
            Lights = bridge.lights.Select(l => l.Value).ToList();

            foreach (var whitelist in bridge.config.WhiteList)
            {
                whitelist.Value.Id = whitelist.Key;
            }
            WhiteList = bridge.config.WhiteList.Select(l => l.Value).ToList();
        }