コード例 #1
0
ファイル: SyncedHueClient.cs プロジェクト: threax/Threax.Home
 /// <summary>
 /// Get the lights.
 /// </summary>
 /// <returns></returns>
 public async Task <IEnumerable <Light> > GetLightsAsync()
 {
     return(await locker.Run(async() =>
     {
         EnsureClient();
         return await client.GetLightsAsync();
     }));
 }
コード例 #2
0
 /// <summary>
 /// Set the power relay to the specified settings.
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 public async Task ApplySettings(IEnumerable <RelaySetting> settings)
 {
     await locker.Run(async() =>
     {
         //Run on background thread, hold locker until done
         await Task.Run(() =>
         {
             powerStrip.SetSettings(settings);
             powerStrip.ApplySettings();
         });
     });
 }
コード例 #3
0
        //Uses the lirc interface
        //http://lirc.org/html/lircd.html

        public async Task <String> SendMessage(String device, String button)
        {
            return(await readLock.Run(async() =>
            {
                var message = ASCIIEncoding.ASCII.GetBytes($"SEND_ONCE {device} {button}\n");
                await tcpStream.WriteAsync(message, 0, message.Length);
                return await GetResult(tcpClient, tcpStream);
            }));
        }
コード例 #4
0
 public async Task <string> GetName(CecLogicalAddress address)
 {
     return(await readLock.Run(() => cecManager.GetName(address)));
 }