From 9b44e30275621a48335fbea7b32b5065a2859c9c Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 16 三月 2021 16:54:33 +0800
Subject: [PATCH] Merge branch 'WJC' into temp-wxr

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs                   |    2 
 HDL_ON/DAL/Mqtt/MqttClient.cs                                     |    7 
 HDL_ON/HDL_ON.projitems                                           |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs                |  201 ++++++++++-
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/MainView.cs         |  143 ++++++++
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs             |   11 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs            |    3 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs    |   70 ++--
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs           |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs               |  332 +++++--------------
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs             |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/HeigthChangeView.cs |  113 +++++++
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs               |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs             |   20 
 14 files changed, 590 insertions(+), 320 deletions(-)

diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index aa1397b..fabaa4a 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -330,7 +330,9 @@
                                 {
                                     var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                     var revString = Encoding.UTF8.GetString(bytes);
-                                    UI.UI2.PersonalCenter.PirDevice.Method.mqttdata = revString;
+                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.controldata = revString;
+                                    //ReceiveCheckGateway(ss);
+                                    //return;
                                 }
                                 //App璁㈤槄閬ユ帶鍣ㄨ嚜瀛︽寜閿涔犳垚鍔熼�氱煡
                                 else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/irCodeStudyDone/up")
@@ -411,6 +413,9 @@
                                     {
                                         MainPage.Log($"璇诲彇浜戠璁惧鏁版嵁澶辫触:Code:{deviceResult.Code};  Msg:{deviceResult.message}");
                                     }
+                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.buttondata = revString;
+                                    //ReceiveCheckGateway(ss);
+                                    //return;
                                 }
                                 #endregion
                                 //A缃戝叧璁惧鐘舵��-鍖呭惈娑傞甫璁惧
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index 55400b6..b64ad47 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -377,6 +377,8 @@
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\ControlView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\AddDevciePage.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\DeviceListPage.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\MainView.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\HeigthChangeView.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="$(MSBuildThisFileDirectory)DAL\" />
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
index 559e88a..d22a2ca 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -134,11 +134,12 @@
                     if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                     {
                         Method method = new Method();
-                        var mqttdate = method.MqttDate(control.sid, 25);
-                        if (mqttdate !=null)
+                        Method.buttondata = "";
+                        var mqttdate = method.MqttDate("鎸夐敭", control.sid, 25);
+                        if (mqttdate != null)
                         {
                             //浼戠湢鏄负鏄剧ず寮曞鐣岄潰
-                           // System.Threading.Thread.Sleep(3000);
+                            // System.Threading.Thread.Sleep(3000);
                             //绉婚櫎娣诲姞鎸夐挳寮曞鐣岄潰
                             replication.RemView();
                             var buttonName = control.status.Find((c) => c.value == buttonObj.value);
@@ -173,12 +174,12 @@
                             new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai));
 
                         }
-                     
+
                     }
                     else
                     {
                         Method method = new Method();
-                        method.ErrorShow(responsePackNew);
+                        method.ErrorShow(responsePackNew, "");
                     }
 
                 });
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
index 76f446d..47a0357 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
@@ -243,7 +243,6 @@
                                 loading.Hide();
                                 if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                 {
-                                    ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔�
                                     var buttonObj = control.status.Find((c) => c.value == obj.value);
                                     if (buttonObj != null)
                                     {
@@ -253,7 +252,7 @@
                                 }
                                 else {
                                     Method method = new Method();
-                                    method.ErrorShow(responsePackNew);
+                                    method.ErrorShow(responsePackNew,"");
                                 }
 
                             });
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
index 3958f65..6ea0cc1 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -65,7 +65,7 @@
                 TextAlignment = TextAlignment.Center,
             };
             fLayout.AddChidren(text1Btn);
-            //鍙埌鍒嗙被-鍔熻兘-鐢靛櫒鎿嶄綔浣跨敤
+            //鍙埌鍒嗙被-鍔熻兘-鎿嶄綔浣跨敤
             Button text2Btn = new Button
             {
                 Width = Application.GetRealWidth(375 - 32),
@@ -90,13 +90,41 @@
             this.AddChidren(namePatchView.FLayoutView());
             namePatchView.btnText1.TextID = StringId.yaokongqimingcheng;
             namePatchView.btnText2.Text = control.name;
-            namePatchView.btnClick.MouseUpEventHandler += (sender,e) => {
+          
+            //鎵�灞炲尯鍩�
+            View.PatchView quyuPatchView = new View.PatchView();
+            quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom;
+            this.AddChidren(quyuPatchView.FLayoutView());
+            quyuPatchView.btnText1.TextID = StringId.suoshuquyu;
+            quyuPatchView.btnText2.Text=Intelligence.Automation.LogicMethod.GetGetRoomName(function);
+
+            //缁х画娣诲姞
+            Button addBtn = new Button
+            {
+                Y = quyuPatchView.frameLayout.Bottom + Application.GetRealHeight(125),
+                X = Application.GetRealWidth(16),
+                Width = Application.GetRealWidth(375 - 32),
+                Height = Application.GetRealHeight(20),
+                TextID = StringId.jixutianjia,
+                TextSize = TextSize.text14,
+                TextColor = CSS.CSS_Color.textConfirmColor,
+                TextAlignment = TextAlignment.Center,
+            };
+            this.AddChidren(addBtn);
+            //瀹屾垚
+            View.SaveView saveView = new View.SaveView();
+            this.AddChidren(saveView.FLayoutView());
+            saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
+            #endregion
+            #region  鐣岄潰鐐瑰嚮浜嬩欢
+            //閬ユ帶鍣ㄥ悕绉扮偣鍑讳簨浠�
+            namePatchView.btnClick.MouseUpEventHandler += (sender, e) => {
 
                 List<string> list = new List<string>();
 
-                for (int i = 0; i < Pir.currPir.FunctioList.Count; i++)
+                for (int i = 0; i < PirDevice.Pir.currPir.FunctioList.Count; i++)
                 {
-                    list.Add(Pir.currPir.FunctioList[i].name);
+                    list.Add(PirDevice.Pir.currPir.FunctioList[i].name);
                 }
                 Method method = new Method();
                 method.EditControlName(StringId.editName, list, control.name, (name, view) =>
@@ -127,7 +155,7 @@
                                 else
                                 {
                                     Method methodError = new Method();
-                                    methodError.ErrorShow(responsePackNew);
+                                    methodError.ErrorShow(responsePackNew, "");
                                 }
 
                             });
@@ -139,12 +167,7 @@
 
                 }, () => { });
             };
-            //鎵�灞炲尯鍩�
-            View.PatchView quyuPatchView = new View.PatchView();
-            quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom;
-            this.AddChidren(quyuPatchView.FLayoutView());
-            quyuPatchView.btnText1.TextID = StringId.suoshuquyu;
-            quyuPatchView.btnText2.Text=Intelligence.Automation.LogicMethod.GetGetRoomName(function);
+            //鎵�灞炲尯鍩熺偣鍑讳簨浠�
             quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) =>
             {
                 Method method = new Method();
@@ -154,31 +177,6 @@
                     quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function);
                 });
             };
-
-
-            //缁х画娣诲姞
-            Button addBtn = new Button
-            {
-                Y = quyuPatchView.frameLayout.Bottom + Application.GetRealHeight(125),
-                X = Application.GetRealWidth(16),
-                Width = Application.GetRealWidth(375 - 32),
-                Height = Application.GetRealHeight(20),
-                TextID = StringId.jixutianjia,
-                TextSize = TextSize.text14,
-                TextColor = CSS.CSS_Color.textConfirmColor,
-                TextAlignment = TextAlignment.Center,
-            };
-            this.AddChidren(addBtn);
-            //瀹屾垚
-            View.SaveView saveView = new View.SaveView();
-            this.AddChidren(saveView.FLayoutView());
-            saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
-            #endregion
-            #region  鐣岄潰鐐瑰嚮浜嬩欢
-            //閬ユ帶鍣ㄥ悕绉扮偣鍑讳簨浠�
-            namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
-            //鎵�灞炲尯鍩熺偣鍑讳簨浠�
-            quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
             //缁х画娣诲姞鐐瑰嚮浜嬩欢
             addBtn.MouseUpEventHandler += (sender, e) =>
             {
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs
index 0f62f69..3634608 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs
@@ -261,7 +261,7 @@
                 else
                 {
                     Method method = new Method();
-                    method.ErrorShow(responsePackNew);
+                    method.ErrorShow(responsePackNew,"");
                 }
             }, id, "鍝佺墝绾㈠鐮佸簱鍒楄〃");
         }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
index d936aef..6af3af1 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
@@ -177,9 +177,9 @@
                 if (StringId.xiugaimingzi == intValue)
                 {
                     List<string> list = new List<string>();
-                    for (int b = 0; b < Pir.pirDeviceList.Count; b++)
+                    for (int b = 0; b < PirDevice.Pir.pirDeviceList.Count; b++)
                     {
-                        list.Add(Pir.pirDeviceList[b].name);
+                        list.Add(PirDevice.Pir.pirDeviceList[b].name);
                     }
                     Method methodView = new Method();
                     methodView.EditControlName(StringId.xiugaimingzi, list, pirclick.name, (name, view) =>
@@ -202,12 +202,16 @@
                     TipPopView tipPopView = new TipPopView();
                     tipPopView.TipBox(StringId.tip, text, (dialog) =>
                     {
-
                         Thread(dialog, (responsePackNew) =>
-                        {
-                            dialog.Close();
-                            UIView(vv);
-                        }, "鍒犻櫎", pirclick.deviceId, "");
+                                {
+                                    var pir = Pir.pirDeviceList.Find((c) => c.deviceId == pirclick.deviceId);
+                                    if (pir != null)
+                                    {
+                                        Pir.pirDeviceList.Remove(pirclick);
+                                    }
+                                    dialog.Close();
+                                    UIView(vv);
+                                }, "鍒犻櫎", pirclick.deviceId, "");
                     }, () =>
                     {
                         NewSwitchView(pirclick, vv);
@@ -258,7 +262,7 @@
                         else
                         {
                             Method method = new Method();
-                            method.ErrorShow(responsePackNew);
+                            method.ErrorShow(responsePackNew,"");
                         }
 
                     });
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
index 0325f8a..b5140c1 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
@@ -84,7 +84,7 @@
                                 else
                                 {
                                     Method methodError = new Method(); 
-                                    methodError.ErrorShow(responsePackNew);
+                                    methodError.ErrorShow(responsePackNew,"");
                                 }
 
                             });
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index d0745a8..e62c484 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;
@@ -180,10 +181,24 @@
                                 var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str);
                                 if (pirJosn != null)
                                 {
-                                    if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
+
+/* 椤圭洰鈥淗DL-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);
+
+/* 椤圭洰鈥淗DL-ON_iOS鈥濈殑鏈悎骞剁殑鏇存敼
+鍦ㄦ涔嬪墠:
+                                        Pir.pirDeviceList.Add(pirJosn);
+鍦ㄦ涔嬪悗:
+                                        list.pirDeviceList.Add(pirJosn);
+*/
+                                        PirDevice.Pir.pirDeviceList.Add(pirJosn);
 
                                     }
                                 }
@@ -319,6 +334,7 @@
             })
             { IsBackground = true }.Start();
         }
+   
         /// <summary>
         /// 鍙戦�佸懡浠ょ嚎绋�
         /// </summary>
@@ -326,47 +342,159 @@
         /// <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>
-        /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁
+        /// 鍙戦�佸懡浠ょ嚎绋�
         /// </summary>
-        public static string mqttdata = ""; 
+        /// <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>
+        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 (text == "閬ユ帶鍣�")
+                {
+                    str = controldata;
+                }
+                else if (text == "鎸夐敭")
+                {
+                    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 +509,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;
             }
         }
 
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
index 9ec777a..288f850 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
@@ -5,7 +5,7 @@
 namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
 {
     [System.Serializable]
-    public class Pir : Entity.Function
+    public class Pir : Entity.Function 
     {
         /// <summary>
         /// 绾㈠瀹濆垪琛�
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
index b1e7b74..57fa14e 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -10,7 +10,6 @@
         public PirMain()
         {
             Tag = "PirMain";
-        
         }
         /// <summary>
         /// 涓存椂鍌ㄥ瓨璁惧绫诲瀷鍒楄〃
@@ -28,117 +27,10 @@
             middFLayout.Y = Application.GetRealHeight(64);
             middFLayout.Height = Application.GetRealHeight(667 - 64);
             this.AddChidren(middFLayout);
-
-            FrameLayout pirDeviceFLayout = new FrameLayout();
-            pirDeviceFLayout.Y = Application.GetRealHeight(12);
-            pirDeviceFLayout.X = Application.GetRealWidth(16);
-            pirDeviceFLayout.Width = Application.GetRealWidth(343);
-            pirDeviceFLayout.Height = Application.GetRealHeight(187);
-            pirDeviceFLayout.BackgroundColor = CSS.CSS_Color.view;
-            pirDeviceFLayout.Radius = (uint)Application.GetRealHeight(12);
-            middFLayout.AddChidren(pirDeviceFLayout);
-
-            //璁惧绠$悊
-            Button text1Btn = new Button
-            {
-                Y = Application.GetRealHeight(11),
-                X = Application.GetRealWidth(16),
-                Width = Application.GetRealWidth(120),
-                Height = Application.GetRealHeight(20),
-                TextSize = TextSize.text14,
-                TextColor = CSS.CSS_Color.textConfirmColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextID = StringId.shebeigaunli,
-                IsBold = true,
-            };
-            pirDeviceFLayout.AddChidren(text1Btn);
-
-
-            Button pirIcon = new Button
-            {
-                Y = Application.GetRealHeight(47),
-                X = Application.GetRealWidth(28),
-                Width = Application.GetRealWidth(66),
-                Height = Application.GetRealWidth(66),
-                UnSelectedImagePath = "PirIcon/Infraredtreasure.png",
-            };
-            pirDeviceFLayout.AddChidren(pirIcon);
-
-            //mini鏅鸿兘閬ユ帶鍣�
-            Button text2Btn = new Button
-            {
-                Y = Application.GetRealHeight(70),
-                X = Application.GetRealWidth(112),
-                Width = Application.GetRealWidth(120),
-                Height = Application.GetRealHeight(20),
-                TextSize = TextSize.text14,
-                TextColor = CSS.CSS_Color.textTipColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                Text = "mini鏅鸿兘閬ユ帶鍣�",
-            };
-            pirDeviceFLayout.AddChidren(text2Btn);
-
-            //
-            Button numberDeviceBtn = new Button
-            {
-                Y = Application.GetRealHeight(137),
-                X = Application.GetRealWidth(32),
-                Width = Application.GetRealWidth(100),
-                Height = Application.GetRealHeight(20),
-                TextSize = TextSize.text14,
-                TextColor = CSS.CSS_Color.textColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                Text = "1" + Language.StringByID(StringId.ge),
-                IsBold = true,
-            };
-            pirDeviceFLayout.AddChidren(numberDeviceBtn);
-            //褰撳墠绾㈠閬ユ帶璁惧
-            Button numberDeviceTextBtn = new Button
-            {
-                Y = numberDeviceBtn.Bottom + Application.GetRealHeight(4),
-                X = Application.GetRealWidth(32),
-                Width = Application.GetRealWidth(100),
-                Height = Application.GetRealHeight(14),
-                TextSize = TextSize.text10,
-                TextColor = CSS.CSS_Color.textCancelColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextID = StringId.dangqianhongwaishebei,
-            };
-            pirDeviceFLayout.AddChidren(numberDeviceTextBtn);
-            //
-            Button currDeviceNumberControlBtn = new Button
-            {
-                Y = Application.GetRealHeight(137),
-                X = Application.GetRealWidth(198),
-                Width = Application.GetRealWidth(80),
-                Height = Application.GetRealHeight(20),
-                TextSize = TextSize.text14,
-                TextColor = CSS.CSS_Color.textColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                Text = "1" + Language.StringByID(StringId.ge),
-                IsBold = true,
-            };
-            pirDeviceFLayout.AddChidren(currDeviceNumberControlBtn);
-            //宸叉坊鍔犻仴鎺у櫒
-            Button currDeviceNumberControlTextBtn = new Button
-            {
-                Y = currDeviceNumberControlBtn.Bottom + Application.GetRealHeight(4),
-                X = Application.GetRealWidth(198),
-                Width = Application.GetRealWidth(80),
-                Height = Application.GetRealHeight(14),
-                TextSize = TextSize.text10,
-                TextColor = CSS.CSS_Color.textCancelColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextID = StringId.yitianjiayaokongqi,
-            };
-            pirDeviceFLayout.AddChidren(currDeviceNumberControlTextBtn);
-            ///绾㈠瀹濈偣鍑讳簨浠�
-            FrameLayout clickFLayout = new FrameLayout();
-            pirDeviceFLayout.AddChidren(clickFLayout);
-           
-
+            View.MainView mainView = new View.MainView();
+            mainView.Show(middFLayout);
             FrameLayout deviceListFLayout = new FrameLayout();
-            deviceListFLayout.Y = pirDeviceFLayout.Bottom + Application.GetRealHeight(12);
+            deviceListFLayout.Y = mainView.pirDeviceFLayout.Bottom + Application.GetRealHeight(12);
             deviceListFLayout.X = Application.GetRealWidth(16);
             deviceListFLayout.Width = Application.GetRealWidth(343);
             deviceListFLayout.Height = Application.GetRealHeight(328);
@@ -172,11 +64,6 @@
                 Text = "mini鏅鸿兘閬ユ帶鍣�",
             };
             deviceListFLayout.AddChidren(deviceNameBtn);
-            if (Pir.pirDeviceList.Count != 0)
-            {
-                deviceNameBtn.Text = Pir.pirDeviceList[0].name;
-                Pir.currPir = Pir.pirDeviceList[0];
-            }
 
             //涓嬫媺鍥炬爣
             var dropdownIconBtn = new Button
@@ -188,107 +75,57 @@
                 UnSelectedImagePath = "PirIcon/dropdown.png",
             };
             deviceListFLayout.AddChidren(dropdownIconBtn);
+            #endregion
 
-            deviceNameBtn.MouseUpEventHandler += (sender, e) =>
+            if (Pir.pirDeviceList.Count != 0)
             {
-
-                #region 鍖哄煙寮规鐣岄潰
-                FrameLayout fLayout = new FrameLayout
-                {
-                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
-                };
-                this.AddChidren(fLayout);
-                fLayout.MouseUpEventHandler += (sender1, e1) =>
-                {
-                    fLayout.RemoveFromParent();
-                };
-
-                FrameLayout iconFLyout = new FrameLayout
-                {
-                    X = Application.GetRealWidth(205),
-                    Y = Application.GetRealHeight(314),
-                    Width = Application.GetRealWidth(160),
-                    Height = Application.GetRealHeight(21 + 44),
-                    //BackgroundImagePath = "LogicIcon/bjicon.png",
-                };
-                fLayout.AddChidren(iconFLyout);
-
-                FrameLayout textFLyout = new FrameLayout
-                {
-                    X = Application.GetRealWidth(8),
-                    Y = Application.GetRealHeight(14),
-                    Width = Application.GetRealWidth(144),
-                    Height = Application.GetRealHeight(44),
-                };
-                VerticalScrolViewLayout vv = new VerticalScrolViewLayout
-                {
-                    X = Application.GetRealWidth(8),
-                    Y = Application.GetRealHeight(14),
-                    Width = Application.GetRealWidth(144),
-                    Height = Application.GetRealHeight(44 * 4),
-                };
-
-                if (Pir.pirDeviceList.Count > 4)
-                {
-                    iconFLyout.Height = Application.GetRealHeight(21 + 44 * 4);
-                    iconFLyout.AddChidren(vv);
-                    iconFLyout.BackgroundImagePath = "PirIcon/4.png";
-                }
-                else
-                {
-
-                    iconFLyout.AddChidren(textFLyout);
-                    iconFLyout.Height = Application.GetRealHeight(21 + 44 * Pir.pirDeviceList.Count);
-                    textFLyout.Height = Application.GetRealHeight(44 * Pir.pirDeviceList.Count);
-                    iconFLyout.BackgroundImagePath = $"PirIcon/{Pir.pirDeviceList.Count}.png";
-                }
-                #endregion
-
+                //榛樿绗竴涓孩澶栧疂
+                Pir.currPir = Pir.pirDeviceList[0];
+                int sum = 0;
                 for (int i = 0; i < Pir.pirDeviceList.Count; i++)
                 {
-                    var pirJson = Pir.pirDeviceList[i];
-                    View.PirNameView pirNameView = new View.PirNameView();
-                    if (Pir.pirDeviceList.Count > 4)
-                    {
-                        vv.AddChidren(pirNameView.FLayoutView());
-                    }
-                    else
-                    {
-                        pirNameView.frameLayout.Y = Application.GetRealHeight(i * 44);
-                        textFLyout.AddChidren(pirNameView.FLayoutView());
-                    }
-                    pirNameView.btnName.Text = pirJson.name;
-                    pirNameView.btnClick.Tag = pirJson;
-                    pirNameView.btnClick.MouseUpEventHandler += (sender2, e2) =>
-                    {
-                        fLayout.RemoveFromParent();
-                        deviceNameBtn.Text = pirJson.name;
-                        Pir.currPir = pirJson;
-
-                    };
-                    if (Pir.pirDeviceList.Count - 1 == i)
-                    {
-                        ///鏀瑰彉鏈�鍚庨偅鏉′竴涓嚎鐨勯鑹�,鐣岄潰鏄剧ず鏁堟灉浣滅敤;
-                        pirNameView.btnLine.BackgroundColor = CSS.CSS_Color.view;
-                    }
+                    //鏌ユ壘
+                    sum += Pir.pirDeviceList[i].FunctioList.Count;
                 }
-
-            };
-
-            clickFLayout.MouseUpEventHandler += (sender, e) =>
+                deviceNameBtn.Text = Pir.pirDeviceList[0].name;
+                mainView.numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge);
+                mainView.currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge);
+            }
+            ///璁惧绠$悊鐨勭偣鍑讳簨浠�
+            mainView.clickBtn.MouseUpEventHandler += (sender, e) =>
             {
 
                 DeviceSet deviceSet = new DeviceSet();
                 MainPage.BasePageView.AddChidren(deviceSet);
-                deviceSet.Show(() => {
+                deviceSet.Show(() =>
+                {
                     if (Pir.currPir != null)
                     {
                         deviceNameBtn.Text = Pir.currPir.name;
+                        mainView.numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge);
                     }
+                    int sum = 0;
+                    for (int i = 0; i < Pir.pirDeviceList.Count; i++)
+                    {
+                        sum += Pir.pirDeviceList[i].FunctioList.Count;
+                    }
+                    mainView.currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge);
+
+
                 });
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             };
-            #endregion
+            ///绾㈠鍚嶇О鐨勭偣鍑讳簨浠�
+            deviceNameBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                View.HeigthChangeView heigthChangeView = new View.HeigthChangeView();
+                heigthChangeView.Show(this, Pir.pirDeviceList, (pirJson) =>
+                {
+                    deviceNameBtn.Text = pirJson.name;
+                    Pir.currPir = pirJson;
+                });
+            };
+
             int line = 0;
             for (int i = 1, j = 0; i <= 7; i++, j++)
             {
@@ -347,45 +184,60 @@
                     }
                     else
                     {
-                        var strings = GetTypeString(if_value).Split('-');
-                        var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]);
-                        if (jobDeviceType == null)
+                        if (DeviceTypeList.Count == 0)
                         {
-                            return;
+                            GetDeviceTypeList(true, () =>
+                             {
+                                 DeviceTypeViewClick(if_value);
+
+                             });
                         }
-                        GetBrandList(jobDeviceType.id, (brandList) =>
+                        else
                         {
-                            var brandSupportStrList = GetBrandSupport(if_value);
-                            var strList = new List<string>();
-                            for (int str = 0; str < brandList.Count; str++)
-                            {
-                                string s = brandList[str].brandName;
-                                var bool_if = brandSupportStrList.Find((c) => s.Contains(c));
-                                if (bool_if != null)
-                                {
-                                    strList.Add(s);
-                                }
-
-                            }
-                            Application.RunOnMainThread(() =>
-                            {
-                                BrandList brandObj = new BrandList();
-                                MainPage.BasePageView.AddChidren(brandObj);
-                                brandObj.Show(brandList, strList, strings[1]);
-                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                            });
-
-                        });
-
+                            DeviceTypeViewClick(if_value);
+                        }
+                    }
+                };
+            }
+        }
+        /// <summary>
+        /// 璁惧杩涘叆涓嬩竴绾ф柟娉�
+        /// </summary>
+        /// <param name="if_value"></param>
+        private void DeviceTypeViewClick(int if_value)
+        {
+            var strings = GetTypeString(if_value).Split('-');
+            var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]);
+            if (jobDeviceType == null)
+            {
+                return;
+            }
+            GetBrandList(jobDeviceType.id, (brandList) =>
+            {
+                var brandSupportStrList = GetBrandSupport(if_value);
+                var strList = new List<string>();
+                for (int str = 0; str < brandList.Count; str++)
+                {
+                    string s = brandList[str].brandName;
+                    var bool_if = brandSupportStrList.Find((c) => s.Contains(c));
+                    if (bool_if != null)
+                    {
+                        strList.Add(s);
                     }
 
+                }
+                Application.RunOnMainThread(() =>
+                {
+                    BrandList brandObj = new BrandList();
+                    MainPage.BasePageView.AddChidren(brandObj);
+                    brandObj.Show(brandList, strList, strings[1]);
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                });
 
-                };
-
-            }
-            GetDeviceTypeList();
+            });
 
         }
+
         /// <summary>
         /// 鑾峰彇鍝佺墝鏀寔
         /// </summary>
@@ -551,7 +403,9 @@
         /// <summary>
         /// 璇诲彇绾㈠璁惧绫诲瀷鍒楄〃
         /// </summary>
-        private void GetDeviceTypeList()
+        /// <param name="tag">鏍囪瘑瑕佷笉瑕佹彁绀猴紙true=鎻愮ず锛�</param>
+        /// <param name="action">鍥炶皟鍑芥暟</param>
+        public  void GetDeviceTypeList(bool tag, Action action)
         {
             PirSend.GetDeviceTypesList(this, (responsePackNew) =>
             {
@@ -574,18 +428,22 @@
                             }
                         }
                     }
+                    action();
                 }
                 else
                 {
-                    Method method = new Method();
-                    method.ErrorShow(responsePackNew);
+                    if (tag)
+                    {
+                        Method method = new Method();
+                        method.ErrorShow(responsePackNew, "");
+                    }
                 }
             }, "", "璁惧绫诲瀷鍒楄〃");
         }
         /// <summary>
         /// 璇诲彇绾㈠璁惧绫诲瀷鐨勫搧鐗屽垪琛�
         /// </summary>
-        private void GetBrandList(string id, Action<List<Brand>> actionBrand)
+        public  void GetBrandList(string id, Action<List<Brand>> actionBrand)
         {
             List<Brand> brandList = new List<Brand>();
             PirSend.GetDeviceTypesList(this, (responsePackNew) =>
@@ -614,7 +472,7 @@
                 else
                 {
                     Method method = new Method();
-                    method.ErrorShow(responsePackNew);
+                    method.ErrorShow(responsePackNew, "");
                 }
             }, id, "鍝佺墝鍒楄〃");
         }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
index 9ef310f..9d51783 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -247,7 +247,7 @@
                         url = "/smart-footstone/app/ir/code/list";
                         jObject.Add("brandId", id);
                     }
-                    responsePackNew = RequestServerhomeId(jObject, url);
+                    responsePackNew = RequestServerhomeId(jObject, url,5);
                 }
                 catch { }
                 finally
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/HeigthChangeView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/HeigthChangeView.cs
new file mode 100644
index 0000000..73d4108
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/HeigthChangeView.cs
@@ -0,0 +1,113 @@
+锘縰sing System;
+using Shared;
+using System.Collections.Generic;
+namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View
+{
+    public class HeigthChangeView
+    {
+
+
+        /// <summary>
+        /// 鑳屾櫙
+        /// </summary>
+        FrameLayout fLayout = new FrameLayout
+        {
+            BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
+        };
+        /// <summary>
+        /// 
+        /// </summary>
+        FrameLayout iconFLyout = new FrameLayout
+        {
+            X = Application.GetRealWidth(205),
+            Y = Application.GetRealHeight(314),
+            Width = Application.GetRealWidth(160),
+            Height = Application.GetRealHeight(21 + 44),
+            //BackgroundImagePath = "LogicIcon/bjicon.png",
+        };
+        /// <summary>
+        /// 
+        /// </summary>
+        FrameLayout textFLyout = new FrameLayout
+        {
+            X = Application.GetRealWidth(8),
+            Y = Application.GetRealHeight(14),
+            Width = Application.GetRealWidth(144),
+            Height = Application.GetRealHeight(44),
+        };
+        /// <summary>
+        /// 
+        /// </summary>
+        VerticalScrolViewLayout vv = new VerticalScrolViewLayout
+        {
+            X = Application.GetRealWidth(8),
+            Y = Application.GetRealHeight(14),
+            Width = Application.GetRealWidth(144),
+            Height = Application.GetRealHeight(44 * 4),
+        };
+        /// <summary>
+        /// View鏂规硶
+        /// </summary>
+        /// <param name="frame"></param>
+        /// <param name="list"></param>
+        /// <param name="action"></param>
+        public void Show(FrameLayout frame, List<Pir> list, Action<Pir> action)
+        {
+
+            frame.AddChidren(fLayout);
+            fLayout.AddChidren(iconFLyout);
+
+            fLayout.MouseUpEventHandler += (sender1, e1) =>
+            {
+                fLayout.RemoveFromParent();
+            };
+            if (list.Count > 4)
+            {
+                iconFLyout.Height = Application.GetRealHeight(21 + 44 * 4);
+                iconFLyout.AddChidren(vv);
+                iconFLyout.BackgroundImagePath = "PirIcon/4.png";
+            }
+            else
+            {
+
+                iconFLyout.AddChidren(textFLyout);
+                iconFLyout.Height = Application.GetRealHeight(21 + 44 * list.Count);
+                textFLyout.Height = Application.GetRealHeight(44 * list.Count);
+                iconFLyout.BackgroundImagePath = $"PirIcon/{list.Count}.png";
+            }
+
+
+            for (int i = 0; i < list.Count; i++)
+            {
+                var pirJson = list[i];
+                View.PirNameView pirNameView = new View.PirNameView();
+                if (list.Count > 4)
+                {
+                    vv.AddChidren(pirNameView.FLayoutView());
+                }
+                else
+                {
+                    pirNameView.frameLayout.Y = Application.GetRealHeight(i * 44);
+                    textFLyout.AddChidren(pirNameView.FLayoutView());
+                }
+                pirNameView.btnName.Text = pirJson.name;
+                pirNameView.btnClick.Tag = pirJson;
+                pirNameView.btnClick.MouseUpEventHandler += (sender2, e2) =>
+                {
+                    var pir = pirNameView.btnClick.Tag as Pir;
+                    action(pir);
+                    fLayout.RemoveFromParent();
+
+                    //deviceNameBtn.Text = pirJson.name;
+                    //Pir.currPir = pirJson;
+
+                };
+                if (list.Count - 1 == i)
+                {
+                    ///鏀瑰彉鏈�鍚庨偅鏉′竴涓嚎鐨勯鑹�,鐣岄潰鏄剧ず鏁堟灉浣滅敤;
+                    pirNameView.btnLine.BackgroundColor = CSS.CSS_Color.view;
+                }
+            }
+        }
+    }
+}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/MainView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/MainView.cs
new file mode 100644
index 0000000..b0fcd2d
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/MainView.cs
@@ -0,0 +1,143 @@
+锘縰sing System;
+using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
+using Shared;
+namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View
+{
+    public class MainView
+    {
+        /// <summary>
+        /// 涓荤┖闂�
+        /// </summary>
+        public FrameLayout pirDeviceFLayout = new FrameLayout
+        {
+
+            Y = Application.GetRealHeight(12),
+            X = Application.GetRealWidth(16),
+            Width = Application.GetRealWidth(343),
+            Height = Application.GetRealHeight(187),
+            BackgroundColor = CSS.CSS_Color.view,
+            Radius = (uint)Application.GetRealHeight(12),
+
+        };
+        /// <summary>
+        /// 璁惧绠$悊
+        /// </summary>
+        public Button text1Btn = new Button
+        {
+            Y = Application.GetRealHeight(11),
+            X = Application.GetRealWidth(16),
+            Width = Application.GetRealWidth(120),
+            Height = Application.GetRealHeight(20),
+            TextSize = TextSize.text14,
+            TextColor = CSS.CSS_Color.textConfirmColor,
+            TextAlignment = TextAlignment.CenterLeft,
+            TextID = StringId.shebeigaunli,
+            IsBold = true,
+        };
+
+        /// <summary>
+        /// 鍥炬爣
+        /// </summary>
+        public Button pirIcon = new Button
+        {
+            Y = Application.GetRealHeight(47),
+            X = Application.GetRealWidth(28),
+            Width = Application.GetRealWidth(66),
+            Height = Application.GetRealWidth(66),
+            UnSelectedImagePath = "PirIcon/Infraredtreasure.png",
+        };
+
+        /// <summary>
+        /// mini鏅鸿兘閬ユ帶鍣�
+        /// </summary>
+        public Button text2Btn = new Button
+        {
+            Y = Application.GetRealHeight(70),
+            X = Application.GetRealWidth(112),
+            Width = Application.GetRealWidth(120),
+            Height = Application.GetRealHeight(20),
+            TextSize = TextSize.text14,
+            TextColor = CSS.CSS_Color.textTipColor,
+            TextAlignment = TextAlignment.CenterLeft,
+            Text = "mini鏅鸿兘閬ユ帶鍣�",
+        };
+
+
+        /// <summary>
+        /// 绾㈠瀹濇暟閲�
+        /// </summary>
+        public Button numberDeviceBtn = new Button
+        {
+            Y = Application.GetRealHeight(137),
+            X = Application.GetRealWidth(32),
+            Width = Application.GetRealWidth(100),
+            Height = Application.GetRealHeight(20),
+            TextSize = TextSize.text14,
+            TextColor = CSS.CSS_Color.textColor,
+            TextAlignment = TextAlignment.CenterLeft,
+            Text = "1" + Language.StringByID(StringId.ge),
+            IsBold = true,
+        };
+
+        /// <summary>
+        /// 褰撳墠绾㈠閬ユ帶璁惧
+        /// </summary>
+        public Button numberDeviceTextBtn = new Button
+        {
+            Y = Application.GetRealHeight(137 + 20) + Application.GetRealHeight(4),
+            X = Application.GetRealWidth(32),
+            Width = Application.GetRealWidth(100),
+            Height = Application.GetRealHeight(14),
+            TextSize = TextSize.text10,
+            TextColor = CSS.CSS_Color.textCancelColor,
+            TextAlignment = TextAlignment.CenterLeft,
+            TextID = StringId.dangqianhongwaishebei,
+        };
+
+        /// <summary>
+        /// 鎵�鏈夌孩澶栧疂鐨勯仴鎺у櫒鏁伴噺
+        /// </summary>
+        public Button currDeviceNumberControlBtn = new Button
+        {
+            Y = Application.GetRealHeight(137),
+            X = Application.GetRealWidth(198),
+            Width = Application.GetRealWidth(80),
+            Height = Application.GetRealHeight(20),
+            TextSize = TextSize.text14,
+            TextColor = CSS.CSS_Color.textColor,
+            TextAlignment = TextAlignment.CenterLeft,
+            Text = "1" + Language.StringByID(StringId.ge),
+            IsBold = true,
+        };
+
+        /// <summary>
+        /// 宸叉坊鍔犻仴鎺у櫒
+        /// </summary>
+        public Button currDeviceNumberControlTextBtn = new Button
+        {
+            Y = Application.GetRealHeight(137 + 20) + Application.GetRealHeight(4),
+            X = Application.GetRealWidth(198),
+            Width = Application.GetRealWidth(80),
+            Height = Application.GetRealHeight(14),
+            TextSize = TextSize.text10,
+            TextColor = CSS.CSS_Color.textCancelColor,
+            TextAlignment = TextAlignment.CenterLeft,
+            TextID = StringId.yitianjiayaokongqi,
+        };
+        ///绾㈠瀹濈偣鍑讳簨浠�
+        public Button clickBtn = new Button(); 
+        public void Show(FrameLayout middFLayout)
+        {
+            middFLayout.AddChidren(pirDeviceFLayout);
+            pirDeviceFLayout.AddChidren(text1Btn);
+            pirDeviceFLayout.AddChidren(pirIcon);
+            pirDeviceFLayout.AddChidren(text2Btn);
+            pirDeviceFLayout.AddChidren(numberDeviceBtn);
+            pirDeviceFLayout.AddChidren(numberDeviceTextBtn);
+            pirDeviceFLayout.AddChidren(currDeviceNumberControlBtn);
+            pirDeviceFLayout.AddChidren(currDeviceNumberControlTextBtn);
+            pirDeviceFLayout.AddChidren(clickBtn);
+        }
+
+    }
+}

--
Gitblit v1.8.0