| | |
| | | using Shared; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | | { |
| | |
| | | #region 编辑设备状态 |
| | | switch (device.spk) |
| | | { |
| | | //群控 |
| | | case SPK.GroupControl: |
| | | int height = Application.GetRealHeight(50); |
| | | int attributesNameId=0; |
| | | int count = 0; |
| | | foreach (var attr in (device as GroupControl).attributes) |
| | | { |
| | | if (attr.key == FunctionAttributeKey.OnOff || |
| | | attr.key == FunctionAttributeKey.Brightness || |
| | | attr.key == FunctionAttributeKey.CCT || |
| | | attr.key == FunctionAttributeKey.RGB || |
| | | attr.key == FunctionAttributeKey.Colorful) |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | | view.btnState.Name = "群控"; |
| | | view.frameLayout.Y = count * height; |
| | | fLayout.AddChidren(view.FLayoutView()); |
| | | count++; |
| | | switch (attr.key) |
| | | { |
| | | case FunctionAttributeKey.OnOff: |
| | | attributesNameId = StringId.switchLogic; |
| | | ///开关点击事件 |
| | | view.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, view.btnState, 2); |
| | | }; |
| | | break; |
| | | case FunctionAttributeKey.Brightness: |
| | | attributesNameId = StringId.brightnesLogic; |
| | | view.btnState.Text = "5%";//产品经理晓辉要求改的 2021-11-06 |
| | | ///亮度点击事件 |
| | | view.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | BrightnessMethod(device, view.btnState, view.btnText.Text); |
| | | |
| | | }; |
| | | break; |
| | | case FunctionAttributeKey.CCT: |
| | | attributesNameId = StringId.ColorTemperature; |
| | | ///色温点击事件 |
| | | view.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | ColorTemperatureMethod(device, view.btnState, view.btnText.Text); |
| | | |
| | | }; |
| | | break; |
| | | case FunctionAttributeKey.RGB: |
| | | attributesNameId = StringId.rgbsepan; |
| | | view.btnState.Tag = ""; |
| | | view.btnState.Width = Application.GetRealWidth(16); |
| | | view.btnState.Height = Application.GetRealWidth(16); |
| | | view.btnState.Radius = (uint)Application.GetRealWidth(8); |
| | | view.btnState.X = Application.GetRealWidth(375 - 48 - 16); |
| | | ///RGB色盘点击事件 |
| | | view.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | RgbColorDiskMethod(device, view.btnState, view.btnText.Text); |
| | | }; |
| | | break; |
| | | case FunctionAttributeKey.Colorful: |
| | | attributesNameId = StringId.ColorfulFunction; |
| | | view.btnState.Name = "colorful"; |
| | | ///开关点击事件 |
| | | view.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, view.btnState, 2); |
| | | }; |
| | | break; |
| | | } |
| | | view.btnText.TextID = attributesNameId; |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, view.btnState, null, null, null, attr.key); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //设备延时iewv |
| | | DelayView(fLayout, height* count); |
| | | break; |
| | | //插座(有USB) |
| | | case SPK.PanelSocket: |
| | | { |
| | |
| | | break; |
| | | //灯光开关 亮度 |
| | | case SPK.LightDimming: |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | | //case SPK.LightRGB: |
| | | //case SPK.LightRGBW: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, lightSwitchView.btnState, brightnessView.btnState, null, null); |
| | | } |
| | | #endregion |
| | | } |
| | | break; |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView lightSwitchView = new LogicView.FunTypeView(); |
| | | lightSwitchView.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(lightSwitchView.FLayoutView()); |
| | | ///亮度 |
| | | LogicView.FunTypeView brightnessView = new LogicView.FunTypeView(); |
| | | brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom; |
| | | brightnessView.btnText.TextID = StringId.brightnesLogic; |
| | | fLayout.AddChidren(brightnessView.FLayoutView()); |
| | | brightnessView.btnState.Text = "5%";//产品经理晓辉要求改的 2021-11-06 |
| | | ///RGB色盘 |
| | | LogicView.FunTypeView rgbView = new LogicView.FunTypeView(); |
| | | rgbView.frameLayout.Y = brightnessView.frameLayout.Bottom; |
| | | rgbView.btnText.TextID = StringId.rgbsepan; |
| | | rgbView.btnState.Tag = ""; |
| | | rgbView.btnState.Width = Application.GetRealWidth(16); |
| | | rgbView.btnState.Height = Application.GetRealWidth(16); |
| | | rgbView.btnState.Radius = (uint)Application.GetRealWidth(8); |
| | | rgbView.btnState.X = Application.GetRealWidth(375 - 48 - 16); |
| | | fLayout.AddChidren(rgbView.FLayoutView()); |
| | | ///设备延时iewv |
| | | DelayView(fLayout, rgbView.frameLayout.Bottom); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | lightSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, lightSwitchView.btnState, 2); |
| | | }; |
| | | ///亮度点击事件 |
| | | brightnessView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | BrightnessMethod(device, brightnessView.btnState, brightnessView.btnText.Text); |
| | | |
| | | }; |
| | | ///RGB色盘点击事件 |
| | | rgbView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | RgbColorDiskMethod(device, rgbView.btnState, rgbView.btnText.Text); |
| | | |
| | | }; |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, lightSwitchView.btnState, brightnessView.btnState, rgbView.btnState, null); |
| | | } |
| | | #endregion |
| | | } |
| | |
| | | ///开关 |
| | | LogicView.FunTypeView curtainSwitchView = new LogicView.FunTypeView(); |
| | | curtainSwitchView.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(curtainSwitchView.FLayoutView()); |
| | | //fLayout.AddChidren(curtainSwitchView.FLayoutView());//2023年04月17日16:27:10 产品要求的去掉 |
| | | ///百分比 |
| | | LogicView.FunTypeView crtainPercentumView = new LogicView.FunTypeView(); |
| | | crtainPercentumView.frameLayout.Y = curtainSwitchView.frameLayout.Bottom; |
| | | //crtainPercentumView.frameLayout.Y = curtainSwitchView.frameLayout.Bottom; |
| | | crtainPercentumView.btnText.TextID = StringId.percentum; |
| | | fLayout.AddChidren(crtainPercentumView.FLayoutView()); |
| | | crtainPercentumView.btnState.Text = "5%";//产品经理晓辉要求改的 2021-11-06 |
| | |
| | | break; |
| | | case SPK.AcStandard: |
| | | case SPK.HvacAC: |
| | | case SPK.AcIr: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | { |
| | | SwitchViewMethod(device, acSwitchVie.btnState, 2); |
| | | }; |
| | | int min = device.GetAttribute("set_temp") == null ? 16 : device.GetAttribute("set_temp").min; |
| | | int max = device.GetAttribute("set_temp") == null ? 32 : device.GetAttribute("set_temp").max; |
| | | string unit = InpOrOutLogicMethod.Current.GetTemperatureUnit(device); |
| | | ///温度点击事件 |
| | | temperatureView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = "set_temp"; |
| | | selectedState = device.spk + "_" + keyVlaue; |
| | | string set_temp_value = stateStr.Replace("℃", ""); |
| | | string set_temp_value = stateStr.Replace(unit, ""); |
| | | //数据封装 |
| | | AddDictionary(keyVlaue, set_temp_value); |
| | | }); |
| | | |
| | | }, min, max, unit); |
| | | |
| | | }; |
| | | ///模式点击事件 |
| | |
| | | ///温度点击事件 |
| | | temperatureView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | int min = device.GetAttribute("set_temp") == null ? 16 : device.GetAttribute("set_temp").min; |
| | | int max = device.GetAttribute("set_temp") == null ? 32 : device.GetAttribute("set_temp").max; |
| | | string unit = InpOrOutLogicMethod.Current.GetTemperatureUnit(device); |
| | | string tempValue = temperatureView.btnState.Text; |
| | | LogicView.TemperatureView tempView = new LogicView.TemperatureView(); |
| | | tempView.FLayoutView(this, tempValue, (stateStr) => |
| | |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = "set_temp"; |
| | | selectedState = device.spk + "_" + keyVlaue; |
| | | string set_temp_value = stateStr.Replace("℃", ""); |
| | | string set_temp_value = stateStr.Replace(unit, ""); |
| | | //数据封装 |
| | | AddDictionary(keyVlaue, set_temp_value); |
| | | |
| | | }); |
| | | }, min, max, unit); |
| | | |
| | | }; |
| | | ///模式点击事件 |
| | |
| | | { |
| | | //HDL_ON.DriverLayer.Control.Ins.GetMusicDirectory(device); |
| | | //var palyListName = Music.SendMethod.mMethod.GetListName(device); |
| | | var palyList= Music.SendMethod.Current.GetListMusic(device, "hdl_special"); |
| | | List<string> musicNameList = new List<string>(); |
| | | var palyList= Music.SendMethod.Current.GetSingleSongList(device, "hdl_special",""); |
| | | List<string> songNameList = new List<string>(); |
| | | for (int i = 0; i < palyList.songs.Count; i++) |
| | | { |
| | | var music = palyList.songs[i]; |
| | | musicNameList.Add(music.name); |
| | | var song = palyList.songs[i]; |
| | | songNameList.Add(song.name); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | publicInterface.FrameOrVv(this, musicNameList, new List<string> { funTypeView.btnState.Text }, palyList.group, (index2) => |
| | | publicInterface.FrameOrVv(this, songNameList, new List<string> { funTypeView.btnState.Text }, palyList.group, (index2) => |
| | | { |
| | | var musicSelecetd = palyList.songs[index2]; |
| | | var songSelecetd = palyList.songs[index2]; |
| | | //界面显示选中值 |
| | | funTypeView.btnState.Text = musicSelecetd.name; |
| | | funTypeView.btnState.Text = songSelecetd.name; |
| | | //数据封装 |
| | | AddDictionary("playlist_name", palyList.group);//列表名 |
| | | AddDictionary("song_name", musicSelecetd.name);//歌曲名 |
| | | AddDictionary("song_name", songSelecetd.name);//歌曲名 |
| | | if (!string.IsNullOrEmpty(songSelecetd.url)) |
| | | { |
| | | //存在url就一起发送过去 |
| | | AddDictionary("url", songSelecetd.url); |
| | | } |
| | | |
| | | },false); |
| | | |
| | |
| | | break; |
| | | } |
| | | case SPK.HvacAC: |
| | | case SPK.AcIr: |
| | | case SPK.AcStandard: |
| | | case SPK.FloorHeatStandard: |
| | | case SPK.HvacFloorHeat: |
| | |
| | | dicList.AddRange(diclist);//再添加其它属性 |
| | | dicSateteList = dicList;//重新赋值 |
| | | } |
| | | } |
| | | break; |
| | | case SPK.GroupControl: |
| | | { |
| | | outputDevice.target_type = "5"; |
| | | } |
| | | break; |
| | | |
| | |
| | | } |
| | | } |
| | | break; |
| | | case SPK.GroupControl: |
| | | { |
| | | if (button.Name == "colorful") |
| | | { |
| | | keyVlaue = "colorful"; |
| | | } |
| | | |
| | | } |
| | | break; |
| | | } |
| | | //数据封装 |
| | | AddDictionary(keyVlaue, strValue); |
| | |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | | case SPK.LightCCT: |
| | | case SPK.GroupControl: |
| | | { |
| | | keyVlaue = "brightness"; |
| | | } |
| | |
| | | switch (device.spk) |
| | | { |
| | | case SPK.LightCCT: |
| | | case SPK.GroupControl: |
| | | { |
| | | keyVlaue = "cct"; |
| | | } |
| | |
| | | #endregion |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// RGB色盘专用 |
| | | /// </summary> |
| | | /// <param name="device">设备</param> |
| | | /// <param name="button">状态控件</param> |
| | | /// <param name="titleName">标题</param> |
| | | private void RgbColorDiskMethod(Entity.Function device, Button button, string titleName) |
| | | { |
| | | LogicView.RGBColorView rgbColorView = new LogicView.RGBColorView(); |
| | | rgbColorView.LoadRGBDialog(button.Tag.ToString(), (rgbValueStr) => |
| | | { |
| | | button.BackgroundColor = rgbColorView.GetBackgroundColor(rgbValueStr); |
| | | //界面显示选中值 |
| | | button.Tag = rgbValueStr; |
| | | //button.Text = rgbValueStr; |
| | | selectedState = device.spk + rgbValueStr.ToString(); |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = ""; |
| | | switch (device.spk) |
| | | { |
| | | case SPK.LightRGB: |
| | | case SPK.GroupControl: |
| | | { |
| | | keyVlaue = "rgb"; |
| | | } |
| | | break; |
| | | case SPK.LightRGBW: |
| | | { |
| | | keyVlaue = "rgbw"; |
| | | } |
| | | break; |
| | | } |
| | | //数据封装 |
| | | AddDictionary(keyVlaue, rgbValueStr); |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 显示编辑之前的设备状态 |
| | | /// </summary> |
| | |
| | | /// <param name="button2">显示Btn</param> |
| | | /// <param name="button3">显示Btn</param> |
| | | /// <param name="button4">显示Btn</param> |
| | | private void GetEditDeviceState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4) |
| | | /// <param name="attribute">属性key</param> |
| | | private void GetEditDeviceState(Entity.Function device, int index, Button button1, Button button2, Button button3, Button button4, string attribute="") |
| | | { |
| | | Output outputs = Logic.currlogic.output[index]; |
| | | var dicList = outputs.status; |
| | |
| | | this.btnDelay.Text = outputs.delay + "s"; |
| | | this.strdelay = outputs.delay; |
| | | } |
| | | InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4); |
| | | InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4, attribute); |
| | | } |
| | | /// <summary> |
| | | /// 添加选中数据 |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |