| | |
| | | DeviceDate deviceDate = new DeviceDate (); |
| | | deviceDate.gatewayId = SmartHome.Send.GatewayId; |
| | | deviceDate.homeId = SmartHome.Send.HomeId; |
| | | |
| | | |
| | | deviceDate.actions.AddRange (selectedDeviceList); |
| | | timerTemp.controlData = deviceDate; |
| | | |
| | |
| | | revertObj = SmartHome.Send.UpdateTimer (timerTemp); |
| | | |
| | | } else { |
| | | |
| | | |
| | | revertObj = SmartHome.Send.AddTimer (timerTemp); |
| | | } |
| | | |
| | |
| | | } else { |
| | | //提示错误 |
| | | SmartHome.Method method = new SmartHome.Method (); |
| | | if (revertObj.Data != null) { |
| | | method.ShowGetTimerListErrorInfo (revertObj.Data.ToString ()); |
| | | } |
| | | } |
| | | }); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | for (int a = 0; a < dev.attributes.Count; a++) { |
| | | var fundev = dev.attributes [a]; |
| | | if (fundev.key == "brightness") { |
| | | if (fundev.value == "0") { |
| | | btnLevel.Text = "OFF"; |
| | | } else { |
| | | btnLevel.Text = fundev.value + "%"; |
| | | } |
| | | levelBar.Progress = int.Parse (fundev.value); |
| | | } |
| | | } |
| | | } |
| | | } catch { } |
| | |
| | | //DeviceType.LightEnergySwitch |
| | | //DeviceType.LightEnergySocket |
| | | //DeviceType.LightSwitchSocket |
| | | case SPK.ElectricSocket: |
| | | case SPK.LightSwitch: { |
| | | #region 继电器 |
| | | tempSwitch.MouseUpEventHandler += (sender3, e3) => { |
| | |
| | | |
| | | btnChoose.MouseUpEventHandler += (dds, ddss) => { |
| | | btnChoose.IsSelected = !btnChoose.IsSelected; |
| | | if (btnChoose.IsSelected) { |
| | | if (tempSwitch.IsSelected) { |
| | | value = "on"; |
| | | } else { |
| | | value = "off"; |
| | |
| | | break; |
| | | case SPK.CurtainRoller: |
| | | case SPK.CurtainTrietex: |
| | | case SPK.CurtainSwitch: |
| | | { |
| | | case SPK.CurtainSwitch: { |
| | | #region 窗帘 |
| | | tempSwitch.RemoveFromParent (); |
| | | var tempSwitch1 = new Button () { |
| | |
| | | #endregion |
| | | } |
| | | break; |
| | | case "electrical.socket": { |
| | | |
| | | } |
| | | break; |
| | | case SPK.ElectricFan: { |
| | | #region 风扇 |
| | | tempSwitch.RemoveFromParent (); |
| | |
| | | btnFanLevelTip.TextSize = 11; |
| | | } |
| | | } |
| | | |
| | | var fanLevel = new HorizontalSeekBar () { |
| | | X = btnFanLevel.Right, |
| | | Y = btnFanLevel.Y + Application.GetRealHeight (10), |
| | |
| | | |
| | | }; |
| | | deviceRowView.AddChidren (fanLevel); |
| | | value = "2"; |
| | | fanLevel.ProgressChanged += (sender, e) => { |
| | | if (!btnChoose.IsSelected) { |
| | | btnChoose.IsSelected = true; |
| | | } |
| | | value = e.ToString (); |
| | | DeviceDateFun (btnChoose.Tag as Function, value, btnChoose.IsSelected); |
| | | }; |
| | | |
| | | btnChoose.MouseUpEventHandler += (dds, ddss) => { |
| | | btnChoose.IsSelected = !btnChoose.IsSelected; |
| | | DeviceDateFun (btnChoose.Tag as Function, "0", btnChoose.IsSelected); |
| | | DeviceDateFun (btnChoose.Tag as Function, value, btnChoose.IsSelected); |
| | | }; |
| | | if (IsEdit) { |
| | | try { |
| | |
| | | } |
| | | for (int a = 0; a < dev.attributes.Count; a++) { |
| | | var fundev = dev.attributes [a]; |
| | | if (fundev.value == "0") { |
| | | if (fundev.key == "fan_speed_percent") { |
| | | // if (fundev.value == "0") { |
| | | //btnLevel.Text = "OFF"; |
| | | } else { |
| | | // } else { |
| | | fanLevel.Progress = int.Parse (fundev.value); |
| | | // } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | { |
| | | string keyValue = ""; |
| | | switch (function.spk) { |
| | | case "curtain.trietex": |
| | | case "curtain.roller": |
| | | case "light.switch": |
| | | case "curtain.switch": |
| | | case "electrical.socket": { |
| | | case SPK.CurtainTrietex: |
| | | case SPK.CurtainRoller: |
| | | case SPK.LightSwitch: |
| | | case SPK.CurtainSwitch: |
| | | case SPK.ElectricSocket: { |
| | | keyValue = "on_off"; |
| | | } |
| | | break; |
| | | case "light.dimming": { |
| | | case SPK.LightDimming: { |
| | | keyValue = "brightness"; |
| | | } |
| | | break; |
| | | case SPK.ElectricFan: { |
| | | keyValue = "fan_speed_percent"; |
| | | } |
| | | break; |
| | | |
| | |
| | | /// <param name="isSelected">判断控件点击状态</param> |
| | | public void AddDeviceList (Fun fun, bool isSelected) |
| | | { |
| | | |
| | | switch (fun.spk) { |
| | | case SPK.LightDimming: { |
| | | //调光做了一个特殊处理; |
| | | if (fun.attributes.Count == 1) { |
| | | var dic = fun.attributes [0]; |
| | | if (dic.key == "brightness") { |
| | | Attributes attributes = new Attributes (); |
| | | attributes.key = "on_off"; |
| | | if (dic.value == "0") { |
| | | attributes.value = "off"; |
| | | } else { |
| | | attributes.value = "on"; |
| | | } |
| | | fun.attributes.Add (attributes); |
| | | } |
| | | |
| | | } |
| | | break; |
| | | } |
| | | case SPK.ElectricFan: { |
| | | if (fun.attributes.Count == 1) { |
| | | var dic = fun.attributes [0]; |
| | | if (dic.key == "fan_speed_percent") { |
| | | Attributes attributes = new Attributes (); |
| | | attributes.key = "on_off"; |
| | | if (dic.value == "0") { |
| | | attributes.value = "off"; |
| | | } else { |
| | | attributes.value = "on"; |
| | | } |
| | | fun.attributes.Add (attributes); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | var device = selectedDeviceList.Find ((dev) => dev.deviceId == fun.deviceId); |
| | | if (device != null) { |
| | | selectedDeviceList.Remove (device); |