陈嘉乐
2021-03-24 334fa3f807b208335305889f0d5112fcd1f77bfb
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -150,7 +150,7 @@
        /// 红外码学习
        /// </summary>
        /// <returns></returns>
        public static void CodeStudy(string deviceId, AttributesStatus buttonObj,Action<ResponsePackNew> action)
        public static void CodeStudy(Control control, AttributesStatus buttonObj, Action<Cloud> action)
        {
            var job = new JObject { };
            job.Add("key", buttonObj.key);
@@ -160,22 +160,33 @@
            job.Add("value", valuejArray);
            var jArray = new JArray { };
            jArray.Add(job);
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId }, { "attributes", jArray } };
            ResponsePackNew responsePackNew = null;
            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", control.deviceId }, { "attributes", jArray } };
            Cloud cloud = null;
            new System.Threading.Thread(() =>
            {
                try
                {
                    //发送红外码学习命令
                    responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy);
                    var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeStudy);
                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                    {
                        Method method = new Method();
                        Method.buttondata = "";
                        cloud = method.MqttDate("按键", control.sid, 25);
                    }
                    else
                    {
                        Method method = new Method();
                        method.ErrorShow(responsePackNew, "");
                    }
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        action(responsePackNew);
                        action(cloud);
                    });
                }
@@ -267,7 +278,6 @@
            { IsBackground = true }.Start();
        }
        /// <summary>
        ///请求服务器(与住宅有关:例如;homeId) 
        /// </summary>