/// <summary> /// Store the latest know token /// </summary> /// <param name="token"></param> private async void registerAsync(string token) { AddLog(string.Format("GCM: Push Notification - Device Registered - Token : {0}", token)); var Id = UsefulBits.GetDeviceID(); bool bSuccess = await ApiService.RegisterDevice(Id, token); if (bSuccess) { AddLog("GCM: Device registered on Domoticz"); } else { AddLog("GCM: Device not registered on Domoticz"); } }
private async void registerAsync(String token) { tokenUploaded = true; Domoticz.App.AddLog(string.Format("GCM: Push Notification - Device Registered - Token : {0}", token)); String Id = UsefulBits.GetDeviceID(); bool bSuccess = await Domoticz.App.ApiService.RegisterDevice(Id, token); if (bSuccess) { Domoticz.App.AddLog("GCM: Device registered on Domoticz"); } else { Domoticz.App.AddLog("GCM: Device not registered on Domoticz"); } }
/// <summary> /// Domoticz set color /// </summary> public async Task <bool> SetColor(string idx, Color value, string password = null) { if (Server == null) { return(false); } try { var result = await SetRGBAction(idx, ConstantValues.Json.Url.Set.RGBCOLOR, UsefulBits.GetHexString(value), (int)(value.A * 100), password); if (result != null && string.Compare(result.status, "ok", StringComparison.OrdinalIgnoreCase) == 0) { return(true); } } catch (Exception ex) { App.AddLog(ex.Message); } return(false); }