示例#1
0
        public async Task <bool> SetPowerCustomSettingsAsyncTask(PowerCustomSettings state, string id)
        {
            HttpResult comres;

            string url = BridgeUrl + $"/lights/{id}/config/";

            if (!Virtual)
            {
                comres = await HueHttpClient.SendRequestAsyncTask(new Uri(url), WebRequestType.Put, "{\"startup\": { \"customsettings\" : " + Serializer.SerializeJsonObject(state) + "}}");

                if (comres.Success)
                {
                    LastCommandMessages.AddMessage(Serializer.DeserializeToObject <List <IMessage> >(comres.Data));
                    return(LastCommandMessages.Success);
                }
            }
            else
            {
                LastCommandMessages.AddMessage(new Success()
                {
                    Address = url, value = state.ToString()
                });
                return(LastCommandMessages.Success);
            }

            return(false);
        }
示例#2
0
 public Form_PowerCustomSettings(PowerCustomSettings lightstate, string id)
 {
     InitializeComponent();
     _id   = id;
     pfsvm = DataContext as PowerCustomSettingsViewModel;
     pfsvm.Customsettings = lightstate;
 }