From 6d73bf6e816570291865674bef8bce8972e4de3f Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期三, 01 十二月 2021 16:32:57 +0800 Subject: [PATCH] 2021-12-01-01 --- HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage_AddIrButton.cs | 60 +++++++++++++++++++++++++++++++----------------------------- 1 files changed, 31 insertions(+), 29 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage_AddIrButton.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage_AddIrButton.cs index 88fab8d..58df0a8 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage_AddIrButton.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage_AddIrButton.cs @@ -9,8 +9,11 @@ { public class AcControlPage_AddIrButton : FrameLayout { - public AcControlPage_AddIrButton() + Action action; + + public AcControlPage_AddIrButton(Action act) { + action = act; } public void Show(Function control) { @@ -130,38 +133,37 @@ //娣诲姞鏁版嵁瀵硅薄 AttributesStatus buttonObj = new AttributesStatus(); + + //闃叉key涓嶅敮涓� + var attrCount = control.attributes.Count; + var keyString = "key" + attrCount; + while (true) + { + if (control.attributes.Find((obj) => obj.key == keyString) == null) + { + break; + } + keyString = "key" + (++attrCount); + } buttonObj.key = "key" + control.attributes.Count.ToString(); buttonObj.value = texts; - PirSend.CodeStudy(control.deviceId, buttonObj, (responsePackNew) => - { - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - { - Method method = new Method(); - Method.buttondata = ""; - var mqttdate = method.MqttDate("鎸夐敭", control.sid, 25); - if (mqttdate != null) - { - this.RemoveFromParent(); - control.attributes.Add(new FunctionAttributes() { key = buttonObj.key, value = new System.Collections.Generic.List<string>() { buttonObj.value } }); - } - else - { - replication.RemView(); - new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); - } - } - else - { - Method method = new Method(); - method.ErrorShow(responsePackNew, ""); - } - - }); - - + PirSend.CodeStudy(new Control() { deviceId = control.deviceId, sid = control.sid }, buttonObj, (mqttData) => + { + if (mqttData != null) + { + control.attributes.Add(new FunctionAttributes() { key = buttonObj.key, value = new System.Collections.Generic.List<string>() { buttonObj.value } }); + this.RemoveFromParent(); + action?.Invoke(); + //new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiachenggong)); + } + else + { + this.RemoveFromParent(); + new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); + } + }); }; - } } } -- Gitblit v1.8.0