From 6a7a5797af489455bbae8db46c30ec229fc2a020 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 16 三月 2021 13:20:56 +0800 Subject: [PATCH] 2021-3-16-1 --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs | 76 +++++++++++++++++++++++++++---------- 1 files changed, 55 insertions(+), 21 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs index d0745a8..8982e40 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs @@ -84,7 +84,8 @@ if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { string sid = responsePackNew.Data.ToString(); - mqttdate = MqttDate(sid); + controldata = ""; + mqttdate = MqttDate("閬ユ帶鍣�", sid); if (mqttdate != null) { control.sid = sid; @@ -336,37 +337,51 @@ /// <summary> - /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁 + /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑閬ユ帶鍣ㄦ暟鎹� /// </summary> - public static string mqttdata = ""; + public static string controldata = ""; + /// <summary> + /// MQTT涓婚鎺ㄩ�佷笅鏉ユ寜閿殑鏁版嵁 + /// </summary> + public static string buttondata = ""; /// <summary> /// 鍒ゆ柇杩欎釜涓婚鏄惁鏄坊鍔犻仴鎺у櫒涓婚 /// </summary> + /// <param name="text">琛ㄧず涓嶅悓涓婚鏁版嵁</param> /// <param name="sid">鍞竴鏍囪瘑</param> /// <param name="timeValue">绛夊緟鏃堕棿鍊�</param> /// <returns></returns> - public Cloud MqttDate(string sid, int timeValue = 10) + public Cloud MqttDate(string text, string sid, int timeValue = 10) { Cloud cloud = null; var dateTime = DateTime.Now; while ((DateTime.Now - dateTime).TotalMilliseconds < timeValue * 1000) { - if (!string.IsNullOrEmpty(mqttdata)) + string str = ""; + if (str == "閬ユ帶鍣�") + { + str = controldata; + } + else if (str == "鎸夐敭") + { + str = buttondata; + } + + if (!string.IsNullOrEmpty(controldata)) { try { - var cloudjson = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(mqttdata); + var cloudjson = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(str); for (int i = 0; i < cloudjson.objects.Count; i++) { var objects = cloudjson.objects[i]; if (sid == objects.sid) { cloud = cloudjson; - mqttdata = ""; break; } } - if (cloud!=null) + if (cloud != null) { break; } @@ -381,44 +396,63 @@ /// 閿欒鐮佹彁绀� /// </summary> /// <param name="responsePackNew"></param> - /// <param name="str"></param> - public void ErrorShow(ResponsePackNew responsePackNew=null, string str = "") + /// <param name="text">鑷畾涔夐敊璇枃鏈�</param> + /// <param name="popValue">寮规绫诲瀷锛�1=闂儊寮规锛�</param> + public void ErrorShow(ResponsePackNew responsePackNew, string text, int popValue = 1) { - if (str == "鍒犻櫎閬ユ帶鍣�") + string str = ""; + if (text == "鍒犻櫎閬ユ帶鍣�") { - new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.delFail)); - } else if (str == "璇诲彇绾㈠瀹濆垪琛ㄥけ璐�") { - - new Intelligence.Automation.LogicView.TipPopView().FlashingBox("璇诲彇绾㈠瀹濆垪琛ㄥけ璐�"); + str = Language.StringByID(StringId.delFail); + } + else if (text == "璇诲彇绾㈠瀹濆垪琛ㄥけ璐�") + { + str = "璇诲彇绾㈠瀹濆垪琛ㄥけ璐�"; //Language.StringByID(StringId.delFail); } else { - if (responsePackNew != null) { + switch (responsePackNew.Code) { case "14005": { - new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline)); + str = Language.StringByID(StringId.gatewayNotOnline); + } break; case "10807": { - //绾㈠瀹濅笅閬ユ帶鍣ㄨ秴杩囨渶澶�(10涓�)鏁伴噺闄愬埗 - new Intelligence.Automation.LogicView.TipPopView().FlashingBox("绾㈠瀹濅笅閬ユ帶鍣ㄨ秴杩囨渶澶�(10涓�)鏁伴噺闄愬埗"); + str = "绾㈠瀹濅笅閬ユ帶鍣ㄨ秴杩囨渶澶�(10涓�)鏁伴噺闄愬埗";// Language.StringByID(StringId.gatewayNotOnline); + + + } + break; + case "2": + { + str = "绯荤粺缁存姢涓瓇璇风◢鍚庡啀璇晘"; } break; default: { - new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail)); + str ="鑾峰彇鏁版嵁澶辫触" ;// Language.StringByID(StringId.saveFail); } break; } } - + } + switch (popValue) + { + case 1: + { + new Intelligence.Automation.LogicView.TipPopView().FlashingBox(str); + } + break; + case 2: { } break; + case 3: { } break; } } -- Gitblit v1.8.0