陈嘉乐
2021-03-16 6b5f23413ceac72ad97d354e658798c8a422f556
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -181,10 +181,24 @@
                                var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str);
                                if (pirJosn != null)
                                {
                                    if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
/* 项目“HDL-ON_iOS”的未合并的更改
在此之前:
                                    if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
在此之后:
                                    if (null == list.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
*/
                                    if (null == PirDevice.Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
                                    {
                                        Pir.pirDeviceList.Add(pirJosn);
/* 项目“HDL-ON_iOS”的未合并的更改
在此之前:
                                        Pir.pirDeviceList.Add(pirJosn);
在此之后:
                                        list.pirDeviceList.Add(pirJosn);
*/
                                        PirDevice.Pir.pirDeviceList.Add(pirJosn);
                                    }
                                }
@@ -320,6 +334,7 @@
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 发送命令线程
        /// </summary>
@@ -327,15 +342,113 @@
        /// <param name="action">回调函数</param>
        /// <param name="str">判断字符</param>
        /// <param name="frame">log父控件</param>
        /// <param name="dialog">log父控件</param>
        public void ThreadSend(Control control, Action<HDL_ON.DAL.Server.ResponsePackNew> action, string str, FrameLayout frame, Dialog dialog)
        public void ThreadSend(Control control, Action<ResponsePackNew> action, string str, FrameLayout frame)
        {
            //加载log
            Loading loading = new Loading();
            frame.AddChidren(loading);
            loading.Start();
            ResponsePackNew responsePackNew = null;
            new System.Threading.Thread(() =>
            {
                try
                {
                    if (str == "删除")
                    {
                        responsePackNew = PirSend.DeleteDevice(control.deviceId);
                    }
                    else if (str == "修改名称")
                    {
                        responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
                    }
                    else if (str == "删除按键") {
                       // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name);
                    }
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                        {
                            action(responsePackNew);
                        }
                        else
                        {
                            Method method = new Method();
                            method.ErrorShow(responsePackNew, "");
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 发送命令线程
        /// </summary>
        /// <param name="control">发送数据对象</param>
        /// <param name="action">回调函数</param>
        /// <param name="str">判断字符</param>
        /// <param name="dialog">log父控件</param>
        public void ThreadSend(Control control, Action<ResponsePackNew> action, string str,Dialog dialog)
        {
            //加载log
            Loading loading = new Loading();
            dialog.AddChidren(loading);
            ResponsePackNew responsePackNew = null;
            loading.Start();
            new System.Threading.Thread(() =>
            {
                try
                {
                    if (str == "删除")
                    {
                        responsePackNew = PirSend.DeleteDevice(control.deviceId);
                    }
                    else if (str == "修改名称")
                    {
                        responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
                    }
                    else if (str == "删除按键")
                    {
                       // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name);
                    }
                }
                catch { }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        loading.Hide();
                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                        {
                            action(responsePackNew);
                        }
                        else
                        {
                            Method method = new Method();
                            method.ErrorShow(responsePackNew, "");
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// MQTT主题推送下来的遥控器数据
        /// </summary>