| | |
| | | #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 = "总控开关"; |
| | | fLayout.AddChidren(view1.FLayoutView()); |
| | | ///设备延时iewv |
| | | DelayView(fLayout, view1.frameLayout.Bottom); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///总控开关点击事件 |
| | | view1.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, view1.btnState, 2); |
| | | }; |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, view1.btnState, null, null, null); |
| | | } |
| | | #endregion |
| | | } |
| | | break; |
| | | //开关灯光 |
| | | case SPK.AirSwitch: |
| | | case SPK.LightSwitch: |
| | | case SPK.ElectricSocket: |
| | | //机械手 |
| | | case SPK.MechanicalArm: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | |
| | | #endregion |
| | | } |
| | | break; |
| | | //音乐 |
| | | case SPK.MusicStandard: |
| | | case SPK.AvMusic: |
| | | { |
| | | #region 界面 |
| | | //提示语音 |
| | | LogicView.FunTypeView funTypeView = new LogicView.FunTypeView(); |
| | | 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; |
| | | fLayout.AddChidren(volView.FLayoutView()); |
| | | |
| | | ///设备延时iewv |
| | | DelayView(fLayout, volView.frameLayout.Bottom); |
| | | #endregion |
| | | #region 点击事件 |
| | | ///提示语音点击事件 |
| | | funTypeView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | selectedState = device.spk + "_"; |
| | | Loading loading = new Loading(); |
| | | this.AddChidren(loading); |
| | | loading.Start(); |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | try |
| | | { |
| | | //HDL_ON.DriverLayer.Control.Ins.GetMusicDirectory(device); |
| | | //var palyListName = Music.SendMethod.mMethod.GetListName(device); |
| | | 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 song = palyList.songs[i]; |
| | | songNameList.Add(song.name); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | PublicInterface publicInterface = new PublicInterface(); |
| | | publicInterface.FrameOrVv(this, songNameList, new List<string> { funTypeView.btnState.Text }, palyList.group, (index2) => |
| | | { |
| | | var songSelecetd = palyList.songs[index2]; |
| | | //界面显示选中值 |
| | | funTypeView.btnState.Text = songSelecetd.name; |
| | | //数据封装 |
| | | AddDictionary("playlist_name", palyList.group);//列表名 |
| | | AddDictionary("song_name", songSelecetd.name);//歌曲名 |
| | | if (!string.IsNullOrEmpty(songSelecetd.url)) |
| | | { |
| | | //存在url就一起发送过去 |
| | | AddDictionary("url", songSelecetd.url); |
| | | } |
| | | |
| | | },false); |
| | | |
| | | }); |
| | | } |
| | | catch { } |
| | | |
| | | }); |
| | | }; |
| | | ///音量点击事件 |
| | | volView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | selectedState = device.spk + "_volume"; |
| | | new LogicView.TipPopView { }.InputBox(StringId.volumeMusic, volView.btnState.Text, (value) => |
| | | { |
| | | |
| | | //界面显示选中值 |
| | | volView.btnState.Text =value; |
| | | //数据封装 |
| | | AddDictionary("volume", value);//音量 |
| | | },0,100); |
| | | }; |
| | | |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, funTypeView.btnState, volView.btnState, null, null); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | break; |
| | | |
| | | } |
| | | #endregion |
| | |
| | | } |
| | | } |
| | | break; |
| | | //音乐 |
| | | case SPK.MusicStandard: |
| | | case SPK.AvMusic: |
| | | { |
| | | string volume = "volume"; |
| | | var dicObj = dicSateteList.Find((dic) => dic.ContainsValue(volume)); |
| | | if (dicObj != null) |
| | | { |
| | | //有配置音乐音量属性,要重新排列,音量在前面 |
| | | var dicList = new List<Dictionary<string, string>>(); |
| | | dicList.Add(dicObj);//先添加音量属性 |
| | | var diclist = dicSateteList.FindAll((dic) => !dic.ContainsValue(volume)); |
| | | dicList.AddRange(diclist);//再添加其它属性 |
| | | dicSateteList = dicList;//重新赋值 |
| | | } |
| | | } |
| | | break; |
| | | case SPK.GroupControl: |
| | | { |
| | | outputDevice.target_type = "5"; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | outputDevice.status.AddRange(dicSateteList); |
| | | |
| | |
| | | selectedState = device.spk + "_" + strValue; |
| | | //设备属性值,云雀上定义好的; |
| | | string keyVlaue = "on_off"; |
| | | switch (device.spk) |
| | | { |
| | | case SPK.PanelSocket: |
| | | { |
| | | if (button.Name == "总控开关") |
| | | { |
| | | keyVlaue = "on_off_master"; |
| | | } |
| | | } |
| | | 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"; |
| | | } |
| | |
| | | switch (device.spk) |
| | | { |
| | | case SPK.LightRGB: |
| | | case SPK.GroupControl: |
| | | { |
| | | keyVlaue = "rgb"; |
| | | } |