示例#1
0
        async void ToggleRealDevice(int index)
        {
            // This code is just an example of how to work with some IoT devices,
            // for example - LIFX bulbs using LifxHttp library https://github.com/mensly/LifxHttpNet

#if !WINDOWS_UWP
            try
            {
                // generate a new token at https://cloud.lifx.com/settings
                var client = new LifxHttp.LifxClient("your token here");
                var lights = await client.ListLights();

                if (index < lights.Count)
                {
                    await lights[index].TogglePower();
                }
            }
            catch (Exception exc) { }
#endif
        }
示例#2
0
		async void ToggleRealDevice(int index)
		{
			// This code is just an example of how to work with some IoT devices, 
			// for example - LIFX bulbs using LifxHttp library https://github.com/mensly/LifxHttpNet

#if !WINDOWS_UWP
			try
			{
				// generate a new token at https://cloud.lifx.com/settings
				var client = new LifxHttp.LifxClient("your token here");
				var lights = await client.ListLights();
				if (index < lights.Count)
					await lights[index].TogglePower();
			}
			catch (Exception exc) { }
#endif
		}