| | |
| | | using Shared; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using System.Linq; |
| | | |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | | { |
| | |
| | | /// </summary> |
| | | private Button btnDelay =null; |
| | | /// <summary> |
| | | /// 当前设备 |
| | | /// </summary> |
| | | private Function device; |
| | | /// <summary> |
| | | /// 定义一个记录选中设备状态列表; |
| | | /// </summary> |
| | | private List<Dictionary<string, string>> dicSateteList = new List<Dictionary<string, string>>(); |
| | |
| | | public void Show(Entity.Function device, int index, bool edit) |
| | | { |
| | | #region 界面布局 |
| | | this.device = device; |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | LogicView.TopView topView = new LogicView.TopView(); |
| | | this.AddChidren(topView.FLayoutView()); |
| | |
| | | #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: |
| | | { |
| | | #region 界面 |
| | | ///总控开关 |
| | | LogicView.FunTypeView view1 = new LogicView.FunTypeView(); |
| | | view1.btnText.TextID = StringId.zongkogkaiguan; |
| | | view1.btnState.Name = "总控开关"; |
| | | view1.btnText.TextID = StringId.switchLogic; |
| | | //view1.btnState.Name = "总控开关"; |
| | | fLayout.AddChidren(view1.FLayoutView()); |
| | | ///设备延时iewv |
| | | DelayView(fLayout, view1.frameLayout.Bottom); |
| | |
| | | #endregion |
| | | } |
| | | break; |
| | | //开关灯光 |
| | | case SPK.CommonSeries: |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView SerriesSwitchView = new LogicView.FunTypeView(); |
| | | SerriesSwitchView.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(SerriesSwitchView.FLayoutView()); |
| | | |
| | | #endregion |
| | | ///开关点击事件 |
| | | SerriesSwitchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, SerriesSwitchView.btnState, 2); |
| | | }; |
| | | |
| | | break; |
| | | //开关灯光 |
| | | case SPK.OtherCommon: |
| | | case SPK.AirSwitch: |
| | | case SPK.LightSwitch: |
| | | case SPK.ElectricSocket: |
| | |
| | | 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); |
| | | |
| | | }; |
| | | ///模式点击事件 |
| | |
| | | case SPK.AvMusic: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView switchVie = new LogicView.FunTypeView(); |
| | | switchVie.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(switchVie.FLayoutView()); |
| | | //提示语音 |
| | | LogicView.FunTypeView funTypeView = new LogicView.FunTypeView(); |
| | | funTypeView.frameLayout.Y = switchVie.frameLayout.Bottom; |
| | | funTypeView.btnText.TextID = StringId.tishiyin; |
| | | fLayout.AddChidren(funTypeView.FLayoutView()); |
| | | ///音量 |
| | | LogicView.FunTypeView volView = new LogicView.FunTypeView(); |
| | | volView.frameLayout.Y = funTypeView.frameLayout.Bottom; |
| | | volView.btnText.TextID = StringId.volumeMusic; |
| | | volView.btnText.TextID = StringId.volumeMusic; |
| | | fLayout.AddChidren(volView.FLayoutView()); |
| | | |
| | | //if (SPK.AvMusic == device.spk) |
| | | //{ |
| | | // //不支持特殊语音 |
| | | // volView.frameLayout.Y = Application.GetRealHeight(0); |
| | | //} |
| | | |
| | | |
| | | ///设备延时iewv |
| | | DelayView(fLayout, volView.frameLayout.Bottom); |
| | | var delayView = DelayView(fLayout, volView.frameLayout.Bottom); |
| | | if (edit ) |
| | | { |
| | | Output outputs = Logic.currlogic.output[index]; |
| | | var dicList = outputs.status.Find((obj) => obj.ContainsValue(FunctionAttributeKey.OnOff)); |
| | | if (dicList != null) |
| | | { |
| | | if (dicList.ContainsValue( "off") || dicList.ContainsValue("pause")) |
| | | { |
| | | funTypeView.frameLayout.Visible = false; |
| | | volView.frameLayout.Visible = false; |
| | | delayView.frameLayout.Y = switchVie.frameLayout.Bottom; |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | switchVie.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, switchVie.btnState, 2, (v) => { |
| | | if (v == "on") |
| | | { |
| | | funTypeView.frameLayout.Visible = true; |
| | | volView.frameLayout.Visible = true; |
| | | delayView.frameLayout.Y = volView.frameLayout.Bottom; |
| | | } |
| | | else |
| | | { |
| | | funTypeView.frameLayout.Visible = false; |
| | | volView.frameLayout.Visible = false; |
| | | delayView.frameLayout.Y = switchVie.frameLayout.Bottom; |
| | | } |
| | | }); |
| | | }; |
| | | ///提示语音点击事件 |
| | | funTypeView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | { |
| | | //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); |
| | | }, false); |
| | | |
| | | }); |
| | | } |
| | |
| | | selectedState = device.spk + "_volume"; |
| | | new LogicView.TipPopView { }.InputBox(StringId.volumeMusic, volView.btnState.Text, (value) => |
| | | { |
| | | |
| | | |
| | | //界面显示选中值 |
| | | volView.btnState.Text =value; |
| | | volView.btnState.Text = value; |
| | | //数据封装 |
| | | AddDictionary("volume", value);//音量 |
| | | },0,100); |
| | | }, 0, 100); |
| | | }; |
| | | |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, funTypeView.btnState, volView.btnState, null, null); |
| | | GetEditDeviceState(device, index, switchVie.btnState, funTypeView.btnState, volView.btnState, null); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | break; |
| | | //海信电视 |
| | | case SPK.ElectricalTvHisense: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView switchView = new LogicView.FunTypeView(); |
| | | switchView.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(switchView.FLayoutView()); |
| | | ///音量 |
| | | LogicView.FunTypeView volView = new LogicView.FunTypeView(); |
| | | volView.frameLayout.Y = switchView.frameLayout.Bottom; |
| | | volView.btnText.TextID = StringId.yinliang; |
| | | fLayout.AddChidren(volView.FLayoutView()); |
| | | |
| | | ///信号源 |
| | | LogicView.FunTypeView sourceView = new LogicView.FunTypeView(); |
| | | sourceView.frameLayout.Y = volView.frameLayout.Bottom; |
| | | sourceView.btnText.TextID = StringId.xinhaoyuan; |
| | | fLayout.AddChidren(sourceView.FLayoutView()); |
| | | |
| | | ///设备延时iewv |
| | | DelayView(fLayout, sourceView.frameLayout.Bottom); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | switchView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, switchView.btnState, 2); |
| | | }; |
| | | ///音量点击事件 |
| | | volView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | //selectedState = device.spk + "_volume"; |
| | | //new LogicView.TipPopView { }.InputBox(StringId.volumeMusic, volView.btnState.Text, (value) => |
| | | //{ |
| | | |
| | | // //界面显示选中值 |
| | | // volView.btnState.Text = value; |
| | | // //数据封装 |
| | | // AddDictionary("setvolume", value);//音量 |
| | | //}, 0, 100); |
| | | |
| | | BrightnessMethod(device, volView.btnState, volView.btnText.Text); |
| | | |
| | | }; |
| | | |
| | | ///信号源点击事件 |
| | | sourceView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | ///之前的状态文本 |
| | | string currText = sourceView.btnState.Text; |
| | | //设备属性值,云雀上定义好的; |
| | | string key = "signal"; |
| | | selectedState = device.spk + "_" + key; |
| | | PublicInterface pif = new PublicInterface(); |
| | | var dic = pif.GetHisenseSignalSourceDic(); |
| | | pif.SingleSelectionShow(this, dic.Keys.ToList(), Language.StringByID(StringId.xinhaoyuan), currText |
| | | , (valueStr) => |
| | | { |
| | | //界面显示选中值 |
| | | sourceView.btnState.Text = valueStr; |
| | | string value = pif.GetValue(dic, valueStr); |
| | | //数据封装 |
| | | AddDictionary(key, value); |
| | | |
| | | }); |
| | | }; |
| | | |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, switchView.btnState, volView.btnState, sourceView.btnState, null); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | break; |
| | | } |
| | | case SPK.HvacAC: |
| | | case SPK.AcIr: |
| | | case SPK.AcStandard: |
| | | case SPK.FloorHeatStandard: |
| | | case SPK.HvacFloorHeat: |
| | |
| | | dicList.AddRange(diclist);//再添加其它属性 |
| | | dicSateteList = dicList;//重新赋值 |
| | | } |
| | | var onoffDic = dicSateteList.Find((obj) => obj.ContainsValue("on_off")); |
| | | if (onoffDic != null) |
| | | { |
| | | if (onoffDic.ContainsValue("off")) |
| | | { |
| | | for(int i =0;i<dicSateteList.Count;) |
| | | { |
| | | var d = dicSateteList[i]; |
| | | if(!d.ContainsValue("on_off") || d.ContainsValue("delay")) |
| | | { |
| | | dicSateteList.Remove(d); |
| | | continue; |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case SPK.GroupControl: |
| | | { |
| | | outputDevice.target_type = "5"; |
| | | } |
| | | break; |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="fLayout">父控件</param> |
| | | /// <param name="bottomY">在哪个控件下面</param> |
| | | private void DelayView(FrameLayout fLayout, int bottomY) |
| | | private LogicView.FunTypeView DelayView(FrameLayout fLayout, int bottomY) |
| | | { |
| | | LogicView.FunTypeView delayView = new LogicView.FunTypeView(); |
| | | delayView.frameLayout.Y = bottomY; |
| | | delayView.btnText.TextID = StringId.Delay; |
| | | delayView.btnState.Text = strdelay + "s"; |
| | | delayView.btnState.Text = LogicMethod.Current.getTimeStr(strdelay); |
| | | fLayout.AddChidren(delayView.FLayoutView()); |
| | | ///赋值对象 |
| | | this.btnDelay = delayView.btnState; |
| | |
| | | InpOrOutLogicMethod inpOrOutLogicMethod = new InpOrOutLogicMethod(); |
| | | inpOrOutLogicMethod.Delayed(this, strdelay, (value) => |
| | | { |
| | | selectedState = "delay_" + strdelay; |
| | | strdelay = value.ToString(); |
| | | delayView.btnState.Text = strdelay + "s"; |
| | | delayView.btnState.Text = LogicMethod.Current.getTimeStr(strdelay); |
| | | selectedState = "delay_" + strdelay; |
| | | }); |
| | | }; |
| | | return delayView; |
| | | |
| | | } |
| | | |
| | |
| | | /// <param name="device"></param> |
| | | /// <param name="button"></param> |
| | | /// <param name="len">显示选择View数量</param> |
| | | private void SwitchViewMethod(Entity.Function device, Button button, int len) |
| | | /// <param name="action">点击回调事件,用来给音乐刷新界面使用,wxr 2024-01-04 16:03:47</param> |
| | | private void SwitchViewMethod(Entity.Function device, Button button, int len,Action<string> action = null) |
| | | { |
| | | #region 界面 |
| | | FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence }; |
| | | this.AddChidren(frame); |
| | | LogicView.SwitchView switchView = new LogicView.SwitchView(); |
| | | switchView.FLayoutView(frame, len, button.Text, (strValue) => |
| | | switchView.FLayoutView(frame, len, button.Text, (value) => |
| | | { |
| | | int id = 0; |
| | | switch (strValue) |
| | | switch (value) |
| | | { |
| | | case "on": |
| | | { |
| | |
| | | } |
| | | break; |
| | | } |
| | | |
| | | //界面显示选中值 |
| | | button.TextID = id; |
| | | selectedState = device.spk + "_" + strValue; |
| | | selectedState = device.spk + "_" + value; |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = "on_off"; |
| | | string key = "on_off"; |
| | | switch (device.spk) |
| | | { |
| | | case SPK.PanelSocket: |
| | | { |
| | | if (button.Name == "总控开关") |
| | | //if (button.Name == "总控开关") |
| | | //{ |
| | | // key = "on_off_master"; |
| | | //} |
| | | } |
| | | break; |
| | | case SPK.GroupControl: |
| | | { |
| | | if (button.Name == "colorful") |
| | | { |
| | | keyVlaue = "on_off_master"; |
| | | key = "colorful"; |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case SPK.ElectricalTvHisense: |
| | | { |
| | | if ("on" == value) |
| | | { |
| | | key = "wol"; |
| | | } |
| | | |
| | | } |
| | | break; |
| | | } |
| | | |
| | | //数据封装 |
| | | AddDictionary(keyVlaue, strValue); |
| | | AddDictionary(key, value); |
| | | action?.Invoke(value); |
| | | }); |
| | | #endregion |
| | | } |
| | |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | | case SPK.LightCCT: |
| | | case SPK.GroupControl: |
| | | { |
| | | keyVlaue = "brightness"; |
| | | } |
| | |
| | | } |
| | | } |
| | | break; |
| | | case SPK.ElectricalTvHisense: |
| | | { |
| | | keyVlaue = "set_volume"; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | //数据封装 |
| | | AddDictionary(keyVlaue, brightnesValue); |
| | |
| | | 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; |
| | |
| | | if (this.btnDelay != null) |
| | | { |
| | | ///延时显示文本 |
| | | this.btnDelay.Text = outputs.delay + "s"; |
| | | this.btnDelay.Text =LogicMethod.Current.getTimeStr(outputs.delay); |
| | | this.strdelay = outputs.delay; |
| | | } |
| | | InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4); |
| | | InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4, attribute); |
| | | } |
| | | /// <summary> |
| | | /// 添加选中数据 |
| | | /// </summary> |
| | | /// <param name="KeyValue">设备属性值,云雀上定义好的</param> |
| | | /// <param name="selectedValue">状态值</param> |
| | | private void AddDictionary(string KeyValue, string selectedValue) |
| | | /// <param name="key">设备属性值,云雀上定义好的</param> |
| | | /// <param name="value">状态值</param> |
| | | private void AddDictionary(string key, string value) |
| | | { |
| | | //数据封装 |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.Current.dictionary(dic, "key", KeyValue); |
| | | LogicMethod.Current.dictionary(dic, "value", selectedValue); |
| | | AddDictionaryList(KeyValue, dic); |
| | | LogicMethod.Current.dictionary(dic, "key", key); |
| | | LogicMethod.Current.dictionary(dic, "value", value); |
| | | AddDictionaryList(key, dic); |
| | | } |
| | | /// <summary> |
| | | /// 更新数据列表 |
| | | /// </summary> |
| | | /// <param name="keyValue">设备属性值,云雀上定义好的</param> |
| | | /// <param name="key">设备属性值,云雀上定义好的</param> |
| | | /// <param name="dictionary">添加选中数据</param> |
| | | /// <returns></returns> |
| | | private void AddDictionaryList(string keyValue, Dictionary<string, string> dictionary) |
| | | private void AddDictionaryList(string key, Dictionary<string, string> dictionary) |
| | | { |
| | | |
| | | if (this.device.spk == SPK.ElectricalTvHisense) |
| | | { |
| | | //特殊处理 |
| | | if (key == "on_off") |
| | | { |
| | | key = "wol"; |
| | | } |
| | | else if (key == "wol") |
| | | { |
| | | key = "on_off"; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | int indexValue = -1; |
| | | for (int i = 0; i < dicSateteList.Count; i++) |
| | | { |
| | | var dic = dicSateteList[i]; |
| | | if (dic.ContainsValue(keyValue)) |
| | | if (dic.ContainsValue(key)) |
| | | { |
| | | //判断是否存在 |
| | | indexValue = i; |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加目标 |
| | | /// </summary> |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |