2023年07月20日10:26:16
自动化输出增加群控设备
| | |
| | | { |
| | | |
| | | |
| | | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.2.8.165")] |
| | | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] |
| | | public partial class Resource |
| | | { |
| | | |
| | |
| | | //有数据重新赋值 |
| | | dicSateteList.AddRange(dicList); |
| | | } |
| | | InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4); |
| | | InpOrOutLogicMethod.Current.EditDeviceState(device, dicList, button1, button2, button3, button4,""); |
| | | } |
| | | /// <summary> |
| | | /// 添加选中数据 |
| | |
| | | string brightness = GetKeyValue("brightness", dicList); |
| | | string cct = GetKeyValue(FunctionAttributeKey.CCT, dicList); |
| | | string colorful = GetKeyValue(FunctionAttributeKey.Colorful, dicList); |
| | | string rgb = GetKeyValue("rgb", dicList); |
| | | |
| | | |
| | | if (on_off == "on" && brightness != "") |
| | | { |
| | | stateStr = Language.StringByID(StringId.onLogic) + brightness + "%"; |
| | |
| | | stateStr += Language.StringByID(StringId.offLogic); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | |
| | | string rgb = GetKeyValue("rgb", dicList); |
| | | if (!string.IsNullOrEmpty(rgb) && rgb.Length > 6) |
| | | { |
| | | targetView.btnStateColor.Visible = true; |
| | |
| | | break; |
| | | } |
| | | |
| | | if (outputTarget.target_type == "1" || outputTarget.target_type == "3") |
| | | if (outputTarget.target_type == "1" |
| | | || outputTarget.target_type == "3" |
| | | || outputTarget.target_type == "5" |
| | | ) |
| | | { |
| | | targetView.btnState.Text = this.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | |
| | | switch (button.Name) |
| | | { |
| | | case "1": |
| | | case "5": |
| | | { |
| | | //用sid找到设备; |
| | | var device = LogicMethod.Current.GetDevice(outputTarget.sid); |
| | |
| | | this.Delayed(thisView, outputTarget.delay, (value) => |
| | | { |
| | | outputTarget.delay = value.ToString(); |
| | | if (outputTarget.target_type == "1") |
| | | if (outputTarget.target_type == "1" |
| | | || outputTarget.target_type == "5") |
| | | { |
| | | targetView.btnState.Text = this.GetTimeText(outputTarget.delay) + stateStr; |
| | | } |
| | |
| | | /// <param name="button1">显示Btn</param> |
| | | /// <param name="button2">显示Btn</param> |
| | | /// <param name="button3">显示Btn</param> |
| | | /// <param name="button4">显示Btn</param> |
| | | public void EditDeviceState(Entity.Function device, List<Dictionary<string, string>> dicList, Button button1, Button button2, Button button3, Button button4) |
| | | /// <param name="button4">显示Btn</param> |
| | | /// <param name="attribute">属性索引</param> |
| | | public void EditDeviceState(Entity.Function device, List<Dictionary<string, string>> dicList, Button button1, Button button2, Button button3, Button button4, string attribute) |
| | | { |
| | | switch (device.spk) |
| | | { |
| | |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | string key = dic["key"]; |
| | | if (key != attribute) |
| | | { |
| | | continue; |
| | | } |
| | | string value = dic["value"]; |
| | | switch (dic["key"]) |
| | | switch (key) |
| | | { |
| | | case "on_off": |
| | | case "colorful": |
| | |
| | | } |
| | | break; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case SPK.CurtainSwitch: |
| | |
| | | /// 场景=2; |
| | | /// 安防=3; |
| | | /// 延时=4; |
| | | /// 群控=5; |
| | | /// </summary> |
| | | public string target_type = ""; |
| | | public List<Dictionary<string, string>> status = new List<Dictionary<string, string>>(); |
| | |
| | | { |
| | | //群控 |
| | | case SPK.GroupControl: |
| | | int bottom = 50; |
| | | int height = Application.GetRealHeight(50); |
| | | int attributesNameId=0; |
| | | int count = 0; |
| | | foreach (var attr in (device as GroupControl).attributes) |
| | |
| | | { |
| | | LogicView.FunTypeView view = new LogicView.FunTypeView(); |
| | | view.btnState.Name = "群控"; |
| | | view.frameLayout.Y = count * Application.GetRealHeight(50); |
| | | view.frameLayout.Y = count * height; |
| | | fLayout.AddChidren(view.FLayoutView()); |
| | | count++; |
| | | switch (attr.key) |
| | |
| | | break; |
| | | case FunctionAttributeKey.Colorful: |
| | | attributesNameId = StringId.ColorfulFunction; |
| | | view.btnState.Name = "colorful"; |
| | | ///开关点击事件 |
| | | view.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, view.btnState, null, null, null); |
| | | GetEditDeviceState(device, index, view.btnState, null, null, null, attr.key); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //设备延时iewv |
| | | DelayView(fLayout, Application.GetRealHeight(50)* count); |
| | | DelayView(fLayout, height* count); |
| | | break; |
| | | //插座(有USB) |
| | | case SPK.PanelSocket: |
| | |
| | | break; |
| | | case SPK.GroupControl: |
| | | { |
| | | keyVlaue = "colorful"; |
| | | if (button.Name == "colorful") |
| | | { |
| | | keyVlaue = "colorful"; |
| | | } |
| | | |
| | | } |
| | | break; |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /// <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> |
| | | /// 添加选中数据 |