From 8e5ba5665861b29a4b8da0335c81d620aa891862 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 08 三月 2021 09:23:54 +0800
Subject: [PATCH] Merge branch 'WJC' into temp-wxr

---
 HDL-ON_Android/Assets/Language.ini                              |   57 +
 HDL-ON_Android/Assets/Phone/PirIcon/1.png                       |    0 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs            |  397 ++++++++++
 HDL_ON/DAL/Mqtt/MqttClient.cs                                   |   19 
 HDL_ON/HDL_ON.projitems                                         |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs              |  296 ++++++
 HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs                  |    5 
 HDL-ON_Android/Assets/Phone/PirIcon/right.png                   |    0 
 HDL-ON_Android/Resources/Resource.designer.cs                   |    3 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs |   12 
 HDL-ON_Android/Assets/Phone/PirIcon/2.png                       |    0 
 HDL-ON_Android/Assets/Phone/PirIcon/3.png                       |    0 
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs |  122 +++
 HDL-ON_Android/Assets/Phone/PirIcon/left.png                    |    0 
 HDL_APP_Project.sln                                             |   42 
 HDL-ON_Android/Assets/Phone/PirIcon/4.png                       |    0 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs        |  155 +++
 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs         |   15 
 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs            |    7 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs                 |   83 +
 HDL_ON/DAL/Server/NewAPI.cs                                     |    9 
 HDL_ON/Entity/Function/Function.cs                              |    4 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs          |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs  |   41 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs             |  430 +++++++++-
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs             |    5 
 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs            |    8 
 HDL_ON/Common/R.cs                                              |   15 
 HDL_ON/UI/UI2/3-Intelligence/.DS_Store                          |    0 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs           |   80 +
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirNameView.cs    |   59 +
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs             |  152 +++
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs           |  274 ++++++
 33 files changed, 2,025 insertions(+), 269 deletions(-)

diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index 1b59f7e..ec7ad2d 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -1209,6 +1209,63 @@
 6014=娣诲姞閬ユ帶鍣�
 
 
+6015=鍦ㄧ嚎
+6016=绂荤嚎
+6017=鐗堟湰鍙�
+6018=璇疯緭鍏ラ仴鎺у櫒鍚嶇О
+6019=鎻愮ず锛氶仴鎺у櫒鍒涘缓鍚庡彲鍦ㄥ姛鑳�-鐢靛櫒鍒嗙被{\r\n}鏌ユ壘浣跨敤
+6020=鎺ㄨ崘鎸夐敭
+6021=璇疯緭鍏ユ寜閿悕绉�
+6022=涓嬩竴姝�
+6023=鐢垫簮
+6024=闊抽噺+
+6025=闊抽噺-
+6026=棰戦亾+
+6027=棰戦亾-
+6028=涓�
+6029=涓�
+6030=宸�
+6031=鍙�
+6032=闈欓煶
+6034=纭
+6035=鎾斁
+6037=閫�鍑�
+6038=鑿滃崟
+6039=鏆傚仠
+6040=杩斿洖
+6041=鍋滄
+6042=涓婚〉
+6043=蹇繘
+6044=蹇��
+6045=瀹氭椂
+6046=澶嶅埗閬ユ帶鍔熻兘
+6047=瀵瑰噯閬ユ帶鍣ㄤ腑蹇冩寜涓嬬浉鍚屾寜閿�
+6048=鏅鸿兘閬ユ帶鍣�
+6049=娣诲姞鎸夐敭
+6050=*闀挎寜鍙繘琛岃嚜瀹氫箟鎺掑簭
+6051=瀹屾垚
+6052=娣诲姞鎴愬姛
+6053=鍙埌鍒嗙被-鍔熻兘-鐢靛櫒鎿嶄綔浣跨敤
+6054=鎵�灞炲垎绫�
+6055=閬ユ帶鍣ㄥ悕绉�
+6056=鎵�灞炲尯鍩�
+6057=缁х画娣诲姞
+6058=鐢靛櫒
+6059=娣诲姞澶辫触
+6060=閲嶈瘯
+6061=鍖归厤閬ユ帶鍣�
+6062=璇风偣鍑讳互涓嬫寜閽�
+6063=纭璁惧鏄惁鏈夊搷搴�
+6064=鎺у埗澶辫触
+6065=鎺у埗鎴愬姛
+6066=鐢垫簮寮�
+6067=妯″紡鍒跺喎
+6068=椋庨�熶腑椋�
+6069=娓╁害26鈩�
+6070=鍒犻櫎璁惧
+6071=淇敼鍚嶅瓧
+6072=纭鍒犻櫎
+6073=鍙栨秷
 
 7000=鏂板缓鑷姩鍖�
 7001=缂栬緫鑷姩鍖�
diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/1.png b/HDL-ON_Android/Assets/Phone/PirIcon/1.png
new file mode 100755
index 0000000..fc7c017
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/PirIcon/1.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/2.png b/HDL-ON_Android/Assets/Phone/PirIcon/2.png
new file mode 100755
index 0000000..53153e8
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/PirIcon/2.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/3.png b/HDL-ON_Android/Assets/Phone/PirIcon/3.png
new file mode 100755
index 0000000..3c1487b
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/PirIcon/3.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/4.png b/HDL-ON_Android/Assets/Phone/PirIcon/4.png
new file mode 100755
index 0000000..94e0bdc
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/PirIcon/4.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/left.png b/HDL-ON_Android/Assets/Phone/PirIcon/left.png
new file mode 100755
index 0000000..a7cb542
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/PirIcon/left.png
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/right.png b/HDL-ON_Android/Assets/Phone/PirIcon/right.png
new file mode 100755
index 0000000..49070bb
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/PirIcon/right.png
Binary files differ
diff --git a/HDL-ON_Android/Resources/Resource.designer.cs b/HDL-ON_Android/Resources/Resource.designer.cs
index 52baaa6..506131b 100644
--- a/HDL-ON_Android/Resources/Resource.designer.cs
+++ b/HDL-ON_Android/Resources/Resource.designer.cs
@@ -2,6 +2,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
@@ -14,7 +15,7 @@
 {
 	
 	
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
+	[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
 	public partial class Resource
 	{
 		
diff --git a/HDL_APP_Project.sln b/HDL_APP_Project.sln
index 88ccf63..6e5610f 100644
--- a/HDL_APP_Project.sln
+++ b/HDL_APP_Project.sln
@@ -5,11 +5,9 @@
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HDL-ON_Android", "HDL-ON_Android\HDL-ON_Android.csproj", "{09712674-2A38-407B-B1E2-560B2C352F9A}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blufi", "HdlBluWi\Blufi.csproj", "{2DDF4C3C-6998-432E-9F43-6786D82F0630}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ys", "ys\ys.csproj", "{DF065E3F-C3A1-4908-9582-000974B7C290}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HDL-ON_iOS", "HDL-ON_iOS\HDL-ON_iOS.csproj", "{D998E133-F0DD-4760-BE3C-461632F54DA4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blufi", "HdlBluWi\Blufi.csproj", "{2DDF4C3C-6998-432E-9F43-6786D82F0630}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -33,30 +31,6 @@
 		{09712674-2A38-407B-B1E2-560B2C352F9A}.Debug|iPhone.Build.0 = Debug|Any CPU
 		{09712674-2A38-407B-B1E2-560B2C352F9A}.Release|iPhone.ActiveCfg = Release|Any CPU
 		{09712674-2A38-407B-B1E2-560B2C352F9A}.Release|iPhone.Build.0 = Release|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.Build.0 = Release|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.ActiveCfg = Debug|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.Build.0 = Debug|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.ActiveCfg = Release|Any CPU
-		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.Build.0 = Release|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Release|Any CPU.Build.0 = Release|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhone.ActiveCfg = Debug|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Debug|iPhone.Build.0 = Debug|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhone.ActiveCfg = Release|Any CPU
-		{DF065E3F-C3A1-4908-9582-000974B7C290}.Release|iPhone.Build.0 = Release|Any CPU
 		{D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
 		{D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
 		{D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
@@ -69,5 +43,17 @@
 		{D998E133-F0DD-4760-BE3C-461632F54DA4}.Debug|iPhone.Build.0 = Debug|iPhone
 		{D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|iPhone.ActiveCfg = Release|iPhone
 		{D998E133-F0DD-4760-BE3C-461632F54DA4}.Release|iPhone.Build.0 = Release|iPhone
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|Any CPU.Build.0 = Release|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|iPhone.Build.0 = Debug|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.ActiveCfg = Release|Any CPU
+		{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhone.Build.0 = Release|Any CPU
 	EndGlobalSection
 EndGlobal
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index 7bd22d5..b31ccc6 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -735,6 +735,21 @@
         public const int dianqi = 6058;
         public const int tianjiashibai = 6059;
         public const int chongshii = 6060;
+        public const int pipeiyaokongqi = 6061;
+        public const int dianjianniu = 6062;
+        public const int shifouyouxiangying = 6063;
+        public const int kongzhishibai = 6064;
+        public const int kongzhichenggong = 6065;
+        public const int kaiguankai = 6066; 
+        public const int moshizhileng = 6067;   
+        public const int fengsuzhongfeng = 6068; 
+        public const int wendu26 = 6069;
+        public const int shanchushebei = 6070;
+        public const int xiugaimingzi = 6071;
+        public const int querenshanchu = 6072;
+        public const int quxiao = 6073;
+      
+
 
 
 
diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index d6b5871..62d34ba 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -191,9 +191,17 @@
                         Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/property/send",
                         QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
                     };
+                    //App璁㈤槄绾㈠瀹� / 缃戝叧閬ユ帶鍣ㄦ坊鍔犳垚鍔熼�氱煡
+                    var pirStatus = new MqttTopicFilter()
+                    {
+                        Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found",
+                        QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
+                    };
 
                     Utlis.WriteLine("寮�濮嬭闃咃紒");
-                    var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] {  topicFilterPush2, topicAlinkStatus });
+                    var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] {
+                        pirStatus,
+                        topicFilterPush2, topicAlinkStatus });
                     if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0)
                     {
                         isSubscribeSuccess = true;
@@ -278,6 +286,15 @@
                                     //鏂版尋涓嬬嚎涓婚鏂规 鏀跺埌鎸や笅绾夸富棰�
                                     ReceiveNotifySqueezeAsync(mMes);
                                 }
+                                //App璁㈤槄绾㈠瀹�/缃戝叧閬ユ帶鍣ㄦ坊鍔犳垚鍔熼�氱煡
+                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/topo/found")
+                                {
+                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
+                                    var revString = Encoding.UTF8.GetString(bytes);
+                                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.addcontronsid = revString;
+                                    //ReceiveCheckGateway(ss);
+                                    //return;
+                                }
                                 //A缃戝叧璁惧鐘舵��-鍖呭惈娑傞甫璁惧
                                 else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/property/send")
                                 {
diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs
index 438c3e8..5980a30 100644
--- a/HDL_ON/DAL/Server/NewAPI.cs
+++ b/HDL_ON/DAL/Server/NewAPI.cs
@@ -513,11 +513,20 @@
         /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙�
         /// </summary>
         public const string API_POST_EZ_GetChildToken = "/home-wisdom/platform/childToken";
+        /// <summary>
+        /// 绾㈠瀹�/閬ユ帶鍣ㄥ垹闄�
+        /// </summary>
+        public const string API_POST_Ir_DeviceDel= "/home-wisdom/app/device/remove";
+        /// <summary>
+        /// 淇敼绾㈠瀹濆悕绉�
+        /// </summary>
+        public const string API_POST_Ir_DeviceRename = "/home-wisdom/app/device/rename";
         
 
         #endregion
 
         #endregion
+        #endregion
     }
 
     ///// <summary>
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index 8bd7fe7..3567c12 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -902,6 +902,10 @@
         /// </summary>
         public const string AcStandard = "ac.standard";
         /// <summary>
+        /// 锛堢孩澶栫┖璋冿級
+        /// </summary>
+        public const string AcIr= "ir.ac";
+        /// <summary>
         /// 锛堝湴鐑級
         /// </summary>
         public const string FloorHeatStandard = "floorHeat.standard";
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index ddfcc5a..210b3f1 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -357,6 +357,8 @@
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\ClothesHangerSetTimePage.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmSensor\ArmSensorHistroyPaging.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\AC\AcControlPage.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\Matching.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\PirNameView.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="$(MSBuildThisFileDirectory)UI\" />
diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
index 772cbc7..63256f0 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -615,7 +615,7 @@
                             LoadEvent_SwitchFunction(btnLightPower, item, functionView);
                         };
                         functionPageTitleId = StringId.Lights;
-
+                      
                         #endregion
                         break;
                     case ShowFunction.AC:
@@ -755,7 +755,12 @@
                         btnName.TextID = StringId.SecurityMonitoring;
                         btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                         {
+                          
+#if __IOS__
+                            EZSDK.IOS.EZSDK.Go2EZvizMonitor();
+#else  //瀹夊崜鎽勫儚澶�
                             HDLCommon.Current.Go2EZvizMonitor(bodyView);
+#endif
                         };
                         break;
                     case ShowFunction.Sensor:
diff --git a/HDL_ON/UI/UI2/3-Intelligence/.DS_Store b/HDL_ON/UI/UI2/3-Intelligence/.DS_Store
new file mode 100644
index 0000000..eddb677
--- /dev/null
+++ b/HDL_ON/UI/UI2/3-Intelligence/.DS_Store
Binary files differ
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
index 9e17a7a..3572fd7 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
@@ -204,7 +204,8 @@
                     {
                         list.Add(logic.name);
                     }
-                    new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) =>
+                    new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName,view
+                        ) =>
                     {
                         Logic.currlogic.name = logicName;
                         Logic.currlogic.sid = LogicMethod.NewSid();
@@ -267,7 +268,7 @@
                         })
                         { IsBackground = true }.Start();
 
-                    });
+                    },()=> { });
 
                 }
                 else
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs
index 46020f5..0b9a0d1 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SwitchView.cs
@@ -171,7 +171,7 @@
         ///<param name="stateVuale">涔嬪墠鐨勭姸鎬佸��</param>
         /// <param name="action">杩斿洖鍥炶皟</param>
         /// <returns></returns>
-        public void FLayoutView(FrameLayout frame, int text1, int text2, string stateVuale, Action<int> action)
+        public void FLayoutView(FrameLayout frame, int text1, int text2, string stateVuale, Action<int> action,bool tag=true)
         {
             int i = 2;
             frameLayout.Y = Application.GetRealHeight(603 - (44 * i));
@@ -207,13 +207,19 @@
             btnOn.MouseUpEventHandler += (sender2, e2) =>
             {
                 action(btnOn.TextID);
-                frame.RemoveFromParent();
+                if (tag)
+                {
+                    frame.RemoveFromParent();
+                }
             };
             //鐐瑰嚮浜嬩欢
             btnOff.MouseUpEventHandler += (sender3, e3) =>
             {
                 action(btnOff.TextID);
-                frame.RemoveFromParent();
+                if (tag)
+                {
+                    frame.RemoveFromParent();
+                }
             };
 
 
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
index 227b2e0..acb78cb 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
@@ -26,7 +26,7 @@
         /// <param name="confirmAction">鍥炶皟鍑芥暟</param>
         /// <param name="List">琚绱㈠垪琛�</param>
         /// <param name="confirmAction">鍥炶皟鍑芥暟</param>
-        public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, int errorId_PresenceP, List<string> List, Action<string> confirmAction)
+        public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, int errorId_PresenceP, List<string> List, Action<string,Dialog> confirmAction, Action action,bool tag=true)
         {
             Dialog dialog = new Dialog()
             {
@@ -145,6 +145,8 @@
             btnCancel.MouseUpEventHandler += (sender, e) =>
             {
                 dialog.Close();
+                action();
+
             };
             Button btnTip = new Button
             {
@@ -186,8 +188,10 @@
                 }
 
 
-                confirmAction(editText.Text.Trim());
-                dialog.Close();
+                confirmAction(editText.Text.Trim(),dialog);
+                if (tag) {
+                    dialog.Close();
+                }
             };
 
         }
@@ -199,7 +203,7 @@
         /// <param name="tnputEditTxet">鏄剧ず鏂囨湰</param>
         /// <param name="errorId_IsNullOrEmpty">杈撳叆妗嗘湰鏂囦负绌鸿嚜瀹氫箟鎻愮ず閿欒鏂囨湰</param>
         /// <param name="confirmAction">鍥炶皟鍑芥暟</param>
-        public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction)
+        public void InputBox(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction,Action action)
         {
             Dialog dialog = new Dialog()
             {
@@ -318,6 +322,8 @@
             btnCancel.MouseUpEventHandler += (sender, e) =>
             {
                 dialog.Close();
+                action();
+
             };
 
             Button btnTip = new Button
@@ -672,6 +678,114 @@
         /// 纭畾鎻愮ず妗�
         /// </summary>
         /// <param name="titleId">鏍囬鏂囨湰</param>
+        /// <param name="tipTxet">鑷畾涔夋彁绀烘枃鏈�</param>
+        /// <param name="confirmAction">鍥炶皟鍑芥暟</param>
+        public void TipBox(int titleId, string tipTxet, Action<Dialog> confirmAction,Action action,bool tag=true)
+        {
+            Dialog dialog = new Dialog()
+            {
+                BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
+            };
+
+            FrameLayout whiteView = new FrameLayout()
+            {
+                //Gravity = Gravity.Center,
+                X = Application.GetRealWidth(53),
+                Y = Application.GetRealHeight(264),
+                Width = Application.GetRealWidth(270),
+                Height = Application.GetRealHeight(140),
+                BackgroundColor = CSS_Color.view,
+                BorderColor = CSS_Color.viewTranslucence,
+                BorderWidth = 0,
+                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
+            };
+            dialog.AddChidren(whiteView);
+
+            Button titleBtn = new Button()
+            {
+                Y = Application.GetRealHeight(20),
+                X = Application.GetRealWidth(35),
+                Height = Application.GetRealHeight(22),
+                Width = Application.GetRealWidth(270 - 35 * 2),
+                TextColor = CSS_Color.textConfirmColor,
+                TextSize = TextSize.text16,
+                TextAlignment = TextAlignment.Center,
+                TextID = titleId,
+            };
+            whiteView.AddChidren(titleBtn);
+
+            Button tipBtn = new Button()
+            {
+                Y = titleBtn.Bottom + Application.GetRealHeight(8),
+                X = Application.GetRealWidth(20),
+                Height = Application.GetRealHeight(22),
+                Width = Application.GetRealWidth(270 - 20 * 2),
+                TextColor = CSS_Color.textTipColor,
+                TextSize = TextSize.text12,
+                TextAlignment = TextAlignment.Center,
+                Text= tipTxet,
+            };
+            whiteView.AddChidren(tipBtn);
+
+
+            Button btnLine = new Button()
+            {
+                Y = whiteView.Height - Application.GetRealHeight(44 + 1),
+                Height = Application.GetRealHeight(1),
+                BackgroundColor = CSS_Color.viewLine,
+            };
+            whiteView.AddChidren(btnLine);
+
+            Button btnCancel = new Button()
+            {
+                Y = btnLine.Bottom,
+                Width = Application.GetRealWidth(135),
+                Height = Application.GetRealHeight(44),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.textTipColor,
+                TextSize = TextSize.text16,
+                TextID = StringId.cancelMusic,
+                Gravity = Gravity.BottomLeft,
+            };
+            whiteView.AddChidren(btnCancel);
+            btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
+            Button btnConfirm = new Button()
+            {
+                X = btnCancel.Right,
+                Y = btnLine.Bottom,
+                Width = Application.GetRealWidth(135),
+                Height = Application.GetRealHeight(44),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.view,
+                IsBold = true,
+                TextSize = TextSize.text16,
+                TextID = StringId.confirmMusic,
+                BackgroundColor = CSS_Color.textConfirmColor,
+                Gravity = Gravity.BottomRight,
+            };
+            whiteView.AddChidren(btnConfirm);
+            btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
+            dialog.Show();
+            btnCancel.MouseUpEventHandler += (sender, e) =>
+            {
+                action();
+                dialog.Close();
+            };
+
+            btnConfirm.MouseUpEventHandler += (sender, e) =>
+            {
+                confirmAction(dialog);
+                if (tag) {
+                    dialog.Close();
+                }
+            };
+
+        }
+
+        /// <summary>
+        /// 纭畾鎻愮ず妗�
+        /// </summary>
+        /// <param name="titleId">鏍囬鏂囨湰</param>
         /// <param name="tipTxet">鑷畾涔夋彁绀烘枃鏈�(鎹㈣)</param>
         /// <param name="confirmAction">鍥炶皟鍑芥暟</param>
         public void TipBox1(int titleId, int tipTxet, Action confirmAction)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
index 15253d8..442dae4 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Set.cs
@@ -61,12 +61,13 @@
                     list.Add(logic.name);
                 }
 
-                new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) =>
+                new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName,view
+                    ) =>
                 {
                     btnAutomationName.Text = logicName;
                     Logic.currlogic.name = logicName;
 
-                });
+                },()=> { });
             };
             nameView.btnClick.MouseUpEventHandler += editClick;
             btnAutomationName.MouseUpEventHandler += editClick;
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
index 05a6cf6..15e23fb 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
@@ -498,13 +498,13 @@
                 #region ---娣诲姞鍔熻兘鍖哄煙
                 residenceAddFunctionView = new FrameLayout()
                 {
-                    //X = residenceAuxiliaryFunctionView.Right,
-                    X = Application.GetRealWidth(28 - 24),
-                    Y = residenceManageView.Bottom,
+                    X = residenceMemberView.Right,
+                    //X = Application.GetRealWidth(28 - 24),
+                    Y = Application.GetRealHeight(68),
                     Width = Application.GetRealWidth(64 + 48),
                     Height = Application.GetRealWidth(64),
                 };
-                //residenceInfoView.AddChidren(residenceAddFunctionView);
+                residenceInfoView.AddChidren(residenceAddFunctionView);
                 btnResidenceAddFunctionIcon = new Button
                 {
                     Gravity = Gravity.CenterHorizontal,
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
index 99458f3..17453a7 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
@@ -263,10 +263,17 @@
                 // var page = new ThirdPartyBrandListPage();
                 // MainPage.BasePageView.AddChidren(page);
                 // page.LoadPage();
-                var page = new UI2.PersonalCenter.PirDevice.PirMain();
-                MainPage.BasePageView.AddChidren(page);
-                page.Show();
-                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                //鑾峰彇鍒楄〃
+                HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () =>
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        var page = new UI2.PersonalCenter.PirDevice.PirMain();
+                        MainPage.BasePageView.AddChidren(page);
+                        page.Show();
+                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                    });
+                });
             };
             btnResidenceAddFunctionIcon.MouseUpEventHandler = eventHandler;
             btnResidenceAddFunctionText.MouseUpEventHandler = eventHandler;
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
index 97af281..0d28f9d 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
@@ -154,7 +154,7 @@
                 //MainPage.BasePageView.RemoveViewByTag("Pir");
                 AddControlComplete addControlComplete = new AddControlComplete();
                 MainPage.BasePageView.AddChidren(addControlComplete);
-                addControlComplete.Show(control);
+                addControlComplete.Show(control,false);
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             };
             #endregion
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
index 5a50897..ac1b20d 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -4,13 +4,14 @@
 using Shared;
 namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
 {
-    public class AddControlComplete:FrameLayout
+    public class AddControlComplete : FrameLayout
     {
         public AddControlComplete()
         {
             Tag = "Pir";
         }
-        public void Show(Control control) {
+        public void Show(Control control, bool bool_library)
+        {
             #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             PirDevice.View.TopView topView = new View.TopView();
@@ -18,16 +19,16 @@
             this.AddChidren(topView.FLayoutView());
             topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
 
-            FrameLayout fLayout = new FrameLayout 
+            FrameLayout fLayout = new FrameLayout
             {
-                Y =Application.GetRealHeight(64),
+                Y = Application.GetRealHeight(64),
                 BackgroundColor = CSS.CSS_Color.textWhiteColor,
                 Height = Application.GetRealHeight(224),
                 Width = Application.GetRealWidth(375),
             };
             this.AddChidren(fLayout);
             //
-            Button iconBtn = new Button 
+            Button iconBtn = new Button
             {
                 Y = Application.GetRealHeight(28),
                 X = Application.GetRealWidth(137),
@@ -40,7 +41,7 @@
             //娣诲姞鎴愬姛
             Button text1Btn = new Button
             {
-                Width = Application.GetRealWidth(375-32),
+                Width = Application.GetRealWidth(375 - 32),
                 Height = Application.GetRealHeight(22),
                 Y = Application.GetRealHeight(158),
                 X = Application.GetRealWidth(16),
@@ -65,7 +66,7 @@
             fLayout.AddChidren(text2Btn);
             //鎵�灞炲垎绫�
             View.PatchView fenlei = new View.PatchView();
-            fenlei.frameLayout.Y = fLayout.Bottom+ Application.GetRealHeight(8);
+            fenlei.frameLayout.Y = fLayout.Bottom + Application.GetRealHeight(8);
             this.AddChidren(fenlei.FLayoutView(false));
             fenlei.btnText1.TextID = StringId.suoshufenlei;
             fenlei.btnText2.TextID = StringId.dianqi;
@@ -87,7 +88,7 @@
             {
                 Y = quyuPatchView.frameLayout.Bottom + Application.GetRealHeight(125),
                 X = Application.GetRealWidth(16),
-                Width = Application.GetRealWidth(375-32),
+                Width = Application.GetRealWidth(375 - 32),
                 Height = Application.GetRealHeight(20),
                 TextID = StringId.jixutianjia,
                 TextSize = TextSize.text14,
@@ -102,16 +103,30 @@
             #endregion
             #region  鐣岄潰鐐瑰嚮浜嬩欢
             //閬ユ帶鍣ㄥ悕绉扮偣鍑讳簨浠�
-            namePatchView.btnClick.MouseUpEventHandler += (sender,e) => { };
+            namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
             //鎵�灞炲尯鍩熺偣鍑讳簨浠�
             quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => { };
             //缁х画娣诲姞鐐瑰嚮浜嬩欢
-            addBtn.MouseUpEventHandler += (sender, e) => {
-                Method method = new Method();
-                method.AddControl();
+            addBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                if (bool_library)
+                {
+                    this.RemoveFromParent();
+                }
+                else
+                {
+                    Method method = new Method();
+                    method.AddControl(this, (control1) => {
+                        AddButton addButton = new AddButton();
+                        MainPage.BasePageView.AddChidren(addButton);
+                        addButton.Show(control1);
+                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                    });
+                }
             };
             //瀹屾垚鐐瑰嚮浜嬩欢
-            saveView.btnClick.MouseUpEventHandler += (sender, e) => {
+            saveView.btnClick.MouseUpEventHandler += (sender, e) =>
+            {
                 MainPage.BasePageView.RemoveViewByTag("AddControl");
                 MainPage.BasePageView.RemoveViewByTag("Pir");
             };
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs
index 06e00f9..0f62f69 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs
@@ -16,18 +16,9 @@
         /// 
         /// </summary>
         /// <param name="list">琛ㄧず璇ュ垪琛ㄥ厓绱燗-Z瀛楁瘝绛涢�夋樉绀哄嚭鏉�</param>
-        /// <param name="list6">琛ㄧず璇ュ垪琛ㄥ厓绱犳樉绀哄湪list鍓嶉潰(璇ュ垪琛ㄥ厓绱犱笉鍋欰-Z瀛楁瘝绛涢��),娌℃湁鍙互涓簂ist6=null</param>
-        public void Show(List<string> list, List<string> list6)
+        public void Show(List<Brand>brandList,List<string> list,string spk)
         {
-            //string text = "30";
-            //byte[] bytes = new byte[text.Length / 2];
-            //for (int i = 0, j = 0; i < bytes.Length; j += 2, i++)
-            //{
-            //    //鎶�16杩涘害杞崲鎴恇yte
-            //    bytes[i] = Convert.ToByte(text.Substring(j, 2), 16);
-            //}
-            ////鎶奲yte鏁扮粍杞崲鎴愭枃瀛�
-            //string str = System.Text.Encoding.UTF8.GetString(bytes);
+
             var frameLayout = new FrameLayout
             {
                 BackgroundColor = CSS.CSS_Color.viewTop,
@@ -97,12 +88,7 @@
             {
                 list = new List<string>();
             }
-            if (list6 == null)
-            {
-                list6 = new List<string>();
-            }
             var list1 = GetDateList(list);
-            list1.InsertRange(0, list6);
 
             var vv = new VerticalScrolViewLayout();
             fram.AddChidren(vv);
@@ -119,7 +105,7 @@
                         listStr.Add(s);
                     }
                 }
-                RefreshLayout(vv, listStr);
+                RefreshLayout(vv, brandList, listStr,spk);
 
             };
             #region A-Z
@@ -176,7 +162,7 @@
             }
             #endregion
 
-            RefreshLayout(vv, list1);
+            RefreshLayout(vv, brandList, list1,spk);
 
         }
         /// <summary>
@@ -184,7 +170,7 @@
         /// </summary>
         /// <param name="vv">鐖舵帶浠�</param>
         /// <param name="list">鏄剧ず鍒楄〃</param>
-        private void RefreshLayout(VerticalScrolViewLayout vv, List<string> list)
+        private void RefreshLayout(VerticalScrolViewLayout vv, List<Brand> brandList, List<string> list,string spk)
         {
             vv.RemoveAll();
             foreach (var str in list)
@@ -224,14 +210,60 @@
                 vv.AddChidren(rowLayout);
                 clickBtn.MouseUpEventHandler += (sen, e) =>
                 {
-                    ////鎵惧埌绱㈠紩鍊�
-                    //var index = list.IndexOf(clickBtn.Tag.ToString());
-
-                    //this.RemoveFromParent();
+                    var name = clickBtn.Tag.ToString();
+                    var brandObj = brandList.Find((c) => c.brandName == name);
+                    if (brandObj==null) {
+                        return;
+                    }
+                    GetLibraryList(brandObj.id, (libraryList) =>
+                     {
+                         Matching matching = new Matching();
+                         MainPage.BasePageView.AddChidren(matching);
+                         matching.Show(libraryList, spk);
+                         MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                     });
+                 
                 };
 
             }
 
+        }
+
+        /// <summary>
+        /// 璇诲彇鍝佺墝绾㈠鐮佸簱鍒楄〃
+        /// </summary>
+        private void GetLibraryList(string id, Action<List<Library>> actionBrand)
+        {
+            List<Library> libraryList = new List<Library>(); 
+            PirSend.GetDeviceTypesList(this, (responsePackNew) =>
+            {
+
+                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                {
+                    //娓呯┖涔嬪墠鏁版嵁
+                    libraryList.Clear();
+                    var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
+                    for (int a = 0; a < jArray.Count; a++)
+                    {
+                        var jay = jArray[a];
+                        var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
+                        var library = Newtonsoft.Json.JsonConvert.DeserializeObject<Library>(str); 
+                        if (library != null)
+                        {
+                            if (libraryList.Count<20)
+                            {
+                                libraryList.Add(library);
+                            }
+                        }
+                    }
+                    actionBrand(libraryList);
+                }
+                else
+                {
+                    Method method = new Method();
+                    method.ErrorShow(responsePackNew);
+                }
+            }, id, "鍝佺墝绾㈠鐮佸簱鍒楄〃");
         }
         /// <summary>
         /// 鍒楄〃鏄惁鍖呭惈璇ュ��(true=鍖呭惈锛宖alse=涓嶅寘鍚�)
@@ -431,5 +463,7 @@
             else return ("ZZ");
         }
     }
+
+   
 }
 
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
index 8ba618f..d7b7c56 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
@@ -11,7 +11,8 @@
         {
             Tag = "PirView";
         }
-        public void Show() {
+        public void Show()
+        {
             #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             PirDevice.View.TopView topView = new View.TopView();
@@ -19,38 +20,64 @@
             topView.topIconBtn.Visible = true;
             this.AddChidren(topView.FLayoutView());
             topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
-            VerticalScrolViewLayout vv = new VerticalScrolViewLayout();
+            VerticalRefreshLayout vv = new VerticalRefreshLayout();
             vv.Height = Application.GetRealHeight(667 - 64);
             vv.Y = Application.GetRealHeight(64);
             this.AddChidren(vv);
-            #endregion
-            int a = 3;
-            int b = 3;
-            for (int i = 0; i < b; i++)
+            vv.BeginHeaderRefreshingAction += () =>
             {
+                //鍏抽棴鍒锋柊View锛�
+                vv.EndHeaderRefreshing();
+                //鑾峰彇鍒楄〃
+                Method.GetPirDeviceList(this,() =>
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        //鍒锋柊鐣岄潰
+                        UIView(vv);
+                    });
+                });
+
+            };
+            #endregion
+            UIView(vv);
+
+        }
+        /// <summary>
+        /// 鍔犺浇UI鐣岄潰
+        /// </summary>
+        /// <param name="vv">涓婁笅婊戞帶浠�</param>
+        void UIView(VerticalRefreshLayout vv)
+        {
+            vv.RemoveAll();
+            for (int i = 0; i < Pir.pirDeviceList.Count; i++)
+            {
+                var pirDevice = Pir.pirDeviceList[i];
                 #region 绾㈠瀹濆浘鏍� 鐗堟湰鍙� 鍚嶇О 鐘舵��
                 FrameLayout fLayout = new FrameLayout
                 {
                     Width = Application.GetRealWidth(375),
-                    Height = Application.GetRealHeight(12+92+(50* a)),
+                    Height = Application.GetRealHeight(12 + 92 + (50 * pirDevice.FunctioList.Count)),
                 };
                 vv.AddChidren(fLayout);
-               
+
                 //绾㈠瀹濇樉绀虹埗鎺т欢
                 FrameLayout devfLayout = new FrameLayout
                 {
                     Y = Application.GetRealHeight(12),
                     X = Application.GetRealWidth(16),
-                    Width = Application.GetRealWidth(375-16*2),
-                    Height = Application.GetRealHeight(92 + (50 * a)),
+                    Width = Application.GetRealWidth(375 - 16 * 2),
+                    Height = Application.GetRealHeight(92 + (50 * pirDevice.FunctioList.Count)),
                     BackgroundColor = CSS.CSS_Color.view,
                     Radius = (uint)Application.GetRealHeight(12),
                 };
                 fLayout.AddChidren(devfLayout);
+
+
                 //绾㈠瀹濆浘鏍�
                 Button priequipmentBtn = new Button
                 {
-                    Y=Application.GetRealHeight(16),
+                    Y = Application.GetRealHeight(16),
                     X = Application.GetRealWidth(5),
                     Width = Application.GetRealWidth(60),
                     Height = Application.GetRealWidth(60),
@@ -61,11 +88,11 @@
                 //绾㈠瀹濆悕绉�
                 Button deviceNameBtn = new Button
                 {
-                    Y=Application.GetRealHeight(16),
+                    Y = Application.GetRealHeight(16),
                     X = priequipmentBtn.Right + Application.GetRealWidth(7),
                     Width = Application.GetRealWidth(120),
                     Height = Application.GetRealHeight(20),
-                    Text = "绾㈠瀹滱"+i.ToString(),
+                    Text = pirDevice.name,
                     TextAlignment = TextAlignment.CenterLeft,
                     TextSize = TextSize.text14,
                     TextColor = CSS.CSS_Color.textColor,
@@ -75,7 +102,7 @@
                 //鐗堟湰鍙�
                 Button versionBtn = new Button
                 {
-                    Y = deviceNameBtn.Bottom+ Application.GetRealHeight(4),
+                    Y = deviceNameBtn.Bottom + Application.GetRealHeight(4),
                     X = priequipmentBtn.Right + Application.GetRealWidth(7),
                     Width = Application.GetRealWidth(120),
                     Height = Application.GetRealHeight(17),
@@ -92,7 +119,7 @@
                     X = priequipmentBtn.Right + Application.GetRealWidth(7),
                     Width = Application.GetRealWidth(120),
                     Height = Application.GetRealHeight(17),
-                    Text = "2",
+                    Text = pirDevice.FunctioList.Count.ToString(),
                     TextAlignment = TextAlignment.CenterLeft,
                     TextSize = TextSize.text12,
                     TextColor = CSS.CSS_Color.textConfirmColor,
@@ -106,7 +133,7 @@
                     X = geBtn.Right,
                     Width = Application.GetRealWidth(20),
                     Height = Application.GetRealHeight(17),
-                    Text ="/10",
+                    Text = "/10",
                     TextAlignment = TextAlignment.CenterLeft,
                     TextSize = TextSize.text12,
                     TextColor = CSS.CSS_Color.textCancelColor,
@@ -115,7 +142,7 @@
                 //鐘舵�佸浘鏍�
                 Button stateIconBtn = new Button
                 {
-                    Y =Application.GetRealHeight(23),
+                    Y = Application.GetRealHeight(23),
                     X = Application.GetRealWidth(291),
                     Width = Application.GetRealWidth(8),
                     Height = Application.GetRealWidth(8),
@@ -129,39 +156,59 @@
                     X = Application.GetRealWidth(303),
                     Width = Application.GetRealWidth(30),
                     Height = Application.GetRealHeight(17),
-                    TextID=StringId.zaixianhwb,
+                    TextID = StringId.zaixianhwb,
                     TextAlignment = TextAlignment.CenterLeft,
                     TextSize = TextSize.text12,
                     TextColor = 0xFF67D569,// CSS.CSS_Color.textColor,
-                    IsBold=true,
+                    IsBold = true,
                 };
                 devfLayout.AddChidren(stateTextBtn);
                 //绾�
                 Button lineBtn = new Button
                 {
-                    Y = Application.GetRealHeight(92)-1,
+                    Y = Application.GetRealHeight(92) - 1,
                     X = Application.GetRealWidth(16),
-                    Width = Application.GetRealWidth(343-16*2),
-                    Height =1,
+                    Width = Application.GetRealWidth(343 - 16 * 2),
+                    Height = 1,
                     BackgroundColor = CSS.CSS_Color.viewLine,
                 };
                 devfLayout.AddChidren(lineBtn);
+                //鐐瑰嚮浜嬩欢
+                FrameLayout clickFram = new FrameLayout
+                {
+                    Y = Application.GetRealHeight(12),
+                    X = Application.GetRealWidth(16),
+                    Width = Application.GetRealWidth(375 - 16 * 2),
+                    Height = Application.GetRealHeight(92),
+                    BackgroundColor = 0x00000000, //CSS.CSS_Color.view,
+                    Radius = (uint)Application.GetRealHeight(12),
+                    Tag = Pir.pirDeviceList[i],
+                };
+                fLayout.AddChidren(clickFram);
 
-                if (b - 1 == i)
+                clickFram.MouseUpEventHandler += (sender, e) =>
+                {
+                    var pirclick = (clickFram.Tag as Pir);
+                    NewSwitchView(pirclick, vv);
+                };
+
+                if (Pir.pirDeviceList.Count - 1 == i)
                 {
                     //鏈�鍚庝竴涓悗闈㈠鍔犻棿闅旇儗鏅�
                     vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) });
                 }
                 #endregion
 
-                for (int j = 0; j < a; j++) {
+                for (int j = 0; j < pirDevice.FunctioList.Count; j++)
+                {
+                    var control = pirDevice.FunctioList[i];
                     RowLayout funControlRow = new RowLayout
                     {
                         Y = Application.GetRealHeight(92 + (50 * j)),
                         Width = Application.GetRealWidth(375 - 16 * 2),
                         Height = Application.GetRealHeight(50),
                         LineColor = CSS.CSS_Color.textWhiteColor,
-                        SubViewWidth=Application.GetRealWidth(68),
+                        SubViewWidth = Application.GetRealWidth(68),
                     };
                     devfLayout.AddChidren(funControlRow);
                     //閬ユ帶鍣ㄥ悕绉�
@@ -170,30 +217,30 @@
                         X = Application.GetRealWidth(16),
                         Width = Application.GetRealWidth(150),
                         Height = Application.GetRealHeight(20),
-                        Text =j.ToString(),
-                        TextAlignment=TextAlignment.CenterLeft,
+                        Text = control.name,
+                        TextAlignment = TextAlignment.CenterLeft,
                         TextSize = TextSize.text14,
                         TextColor = CSS.CSS_Color.textColor,
-                        Gravity=Gravity.CenterVertical,
+                        Gravity = Gravity.CenterVertical,
                     };
                     funControlRow.AddChidren(nameBtn);
                     //閬ユ帶鍣ㄥ尯鍩�
                     Button areaBtn = new Button
                     {
-                        X=Application.GetRealWidth(311+16-(40+100)),
+                        X = Application.GetRealWidth(311 + 16 - (40 + 100)),
                         Width = Application.GetRealWidth(100),
                         Height = Application.GetRealHeight(17),
                         Text = j.ToString(),
                         TextAlignment = TextAlignment.CenterRight,
                         TextSize = TextSize.text12,
                         TextColor = CSS.CSS_Color.textCancelColor,
-                        Gravity =Gravity.CenterVertical,
+                        Gravity = Gravity.CenterVertical,
                     };
                     funControlRow.AddChidren(areaBtn);
                     //涓嬩竴绾у浘鏍�
                     Button nextIconBtn = new Button
                     {
-                        X = Application.GetRealWidth(295+16),
+                        X = Application.GetRealWidth(295 + 16),
                         Width = Application.GetRealWidth(16),
                         Height = Application.GetRealWidth(16),
                         UnSelectedImagePath = "PirIcon/next.png",
@@ -209,8 +256,9 @@
                         TextAlignment = TextAlignment.Center,
                         TextSize = TextSize.text16,
                         TextColor = CSS.CSS_Color.textWhiteColor,
-                        IsBold=true,
-                        BackgroundColor= CSS.CSS_Color.textRedColor,
+                        IsBold = true,
+                        BackgroundColor = CSS.CSS_Color.textRedColor,
+                        Tag = control,
                     };
                     funControlRow.AddRightView(delBtn);
                     //绾�
@@ -223,22 +271,174 @@
                         BackgroundColor = CSS.CSS_Color.viewLine,
                     };
                     funControlRow.AddChidren(line1Btn);
-                    if (j == a - 1)
+                    if (j == pirDevice.FunctioList.Count - 1)
                     {
                         //鏈�鍚庢敼鍙樹竴涓嚎鐨勯鑹�
                         line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence;
                         funControlRow.LineColor = CSS.CSS_Color.viewTranslucence;
                     }
-                    delBtn.MouseUpEventHandler += (sender,e) => {
+                    delBtn.MouseUpEventHandler += (sender, e) =>
+                    {
 
+                        var Function = delBtn.Tag as Entity.Function;
+                        //鍔犺浇log
+                        Loading loading = new Loading();
+                        this.AddChidren(loading);
+                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
+                        loading.Start();
+                        new System.Threading.Thread(() =>
+                        {
+                            try
+                            {
+                                responsePackNew = PirSend.DeleteDevice(Function.deviceId);
+                            }
+                            catch { }
+                            finally
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    loading.Hide();
+                                    try
+                                    {
+                                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                                        {
+                                            pirDevice.FunctioList.Remove(Function);
+                                            UIView(vv);
+                                        }
 
+                                        else
+                                        {
+                                            Method method = new Method();
+                                            method.ErrorShow(responsePackNew);
+                                        }
+                                    }
+                                    catch { }
+
+                                });
+                            }
+
+                        })
+                        { IsBackground = true }.Start();
                     };
                 }
 
-               
+
 
             }
-
         }
+        /// <summary>
+        /// 鍔犺浇寮规
+        /// </summary>
+        /// <param name="pirclick"></param>
+        /// <param name="vv"></param>
+        void NewSwitchView(Pir pirclick, VerticalRefreshLayout vv)
+        {
+            FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence };
+            this.AddChidren(frame);
+            SwitchView switchView = new SwitchView();
+            switchView.btnOff.TextColor = CSS.CSS_Color.textConfirmColor;
+            switchView.FLayoutView(frame, StringId.shanchushebei, StringId.xiugaimingzi, "", (intValue) =>
+            {
+                if (StringId.xiugaimingzi == intValue)
+                {
+                    List<string> list = new List<string>();
+                    for (int b = 0; b < Pir.pirDeviceList.Count; b++)
+                    {
+                        list.Add(Pir.pirDeviceList[b].name);
+                    }
+                    TipPopView tipPopView = new TipPopView();
+                    tipPopView.InputBox(StringId.xiugaimingzi, pirclick.name, StringId.nameNull, StringId.NameAlreadyExists, list, (name, view) =>
+                    {
+                        pirclick.name = name;
+                        //鍔犺浇log
+                        Loading loading = new Loading();
+                        view.AddChidren(loading);
+                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
+                        loading.Start();
+                        new System.Threading.Thread(() =>
+                        {
+                            try
+                            {
+                                responsePackNew = PirSend.DeviceRename(pirclick);
+                            }
+                            catch { }
+                            finally
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    loading.Hide();
+                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                                    {
+                                        view.Close();
+                                        UIView(vv);
+                                    }
+                                    else
+                                    {
+                                        Method method = new Method();
+                                        method.ErrorShow(responsePackNew);
+                                    }
+
+                                });
+                            }
+
+                        })
+                        { IsBackground = true }.Start();
+
+                    }, () =>
+                    {
+                        NewSwitchView(pirclick, vv);
+                    }, false);
+
+                }
+                else
+                {
+                    string text = Language.StringByID(StringId.shanchushebei) + pirclick.name + "?";
+                    TipPopView tipPopView = new TipPopView();
+                    tipPopView.TipBox(StringId.tip, text, (dialog) =>
+                    {
+                        //鍔犺浇log
+                        Loading loading = new Loading();
+                        dialog.AddChidren(loading);
+                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
+                        loading.Start();
+                        new System.Threading.Thread(() =>
+                        {
+                            try
+                            {
+                                responsePackNew = PirSend.DeleteDevice(pirclick.deviceId);
+                            }
+                            catch { }
+                            finally
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    loading.Hide();
+                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                                    {
+                                        dialog.Close();
+                                        UIView(vv);
+                                    }
+                                    else
+                                    {
+
+                                        Method method = new Method();
+                                        method.ErrorShow(responsePackNew);
+                                    }
+
+                                });
+                            }
+
+                        })
+                        { IsBackground = true }.Start();
+                    }, () =>
+                    {
+                        NewSwitchView(pirclick, vv);
+                    }, false);
+
+                }
+            });
+        }
+
+      
     }
 }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
new file mode 100644
index 0000000..ec6420f
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
@@ -0,0 +1,397 @@
+锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.Entity;
+using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
+using Shared;
+namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
+{
+    public class Matching : FrameLayout
+    {
+        public Matching()
+        {
+            Tag = "PirView";
+        }
+        public void Show(List<Library> libraryList,string spk)
+        {
+            #region 鐣岄潰甯冨眬
+            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
+            PirDevice.View.TopView topView = new View.TopView();
+            topView.topNameBtn.TextID = StringId.pipeiyaokongqi;
+            this.AddChidren(topView.FLayoutView());
+            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
+
+            FrameLayout fLayout = new FrameLayout
+            {
+                Y = topView.frameLayout.Bottom,
+                Height = Application.GetRealHeight(667 - 64),
+                Width = Application.GetRealWidth(375),
+            };
+            this.AddChidren(fLayout);
+            //璇风偣鍑讳互涓嬫寜閽�
+            Button text1Btn = new Button
+            {
+                Y = Application.GetRealHeight(60),
+                X = Application.GetRealWidth(16),
+                Width = Application.GetRealWidth(375 - 32),
+                Height = Application.GetRealHeight(20),
+                TextID = StringId.dianjianniu,
+                TextSize = TextSize.text14,
+                TextColor = CSS.CSS_Color.textColor,
+                TextAlignment = TextAlignment.Center,
+
+            };
+            fLayout.AddChidren(text1Btn);
+
+            //纭璁惧鏄惁鏈夊搷搴�
+            Button text2Btn = new Button
+            {
+                Y = Application.GetRealHeight(60 + 24),
+                X = Application.GetRealWidth(16),
+                Width = Application.GetRealWidth(375 - 32),
+                Height = Application.GetRealHeight(20),
+                TextID = StringId.shifouyouxiangying,
+                TextSize = TextSize.text14,
+                TextColor = CSS.CSS_Color.textColor,
+                TextAlignment = TextAlignment.Center,
+            };
+            fLayout.AddChidren(text2Btn);
+            //宸�
+            var leftIconBtn = new Button
+            {
+                Y = Application.GetRealHeight(203),
+                X = Application.GetRealWidth(16),
+                Width = Application.GetRealWidth(36),
+                Height = Application.GetRealWidth(36),
+                UnSelectedImagePath = "PirIcon/left.png",
+            };
+            fLayout.AddChidren(leftIconBtn);
+            //鍙�
+            var rightIconBtn = new Button
+            {
+                Y = Application.GetRealHeight(203),
+                X = Application.GetRealWidth(323),
+                Width = Application.GetRealWidth(36),
+                Height = Application.GetRealWidth(36),
+                UnSelectedImagePath = "PirIcon/right.png",
+            };
+            fLayout.AddChidren(rightIconBtn);
+            //娴嬭瘯鍔熻兘
+            var testBtn = new Button
+            {
+                Y = Application.GetRealHeight(199),
+                X = Application.GetRealWidth(136),
+                Width = Application.GetRealWidth(104),
+                Height = Application.GetRealHeight(44),
+                TextID=StringId.dianyuan,
+                TextSize = TextSize.text16,
+                TextColor = CSS.CSS_Color.textColor,
+                TextAlignment = TextAlignment.Center,
+                Radius = (uint)Application.GetRealHeight(18),
+                BorderWidth = 1,
+                BorderColor = CSS.CSS_Color.textCancelColor,
+            };
+            fLayout.AddChidren(testBtn);
+
+            // 5/10
+            Button sumBtn = new Button
+            {
+                Y = Application.GetRealHeight(267),
+                X = Application.GetRealWidth(170),
+                Width = Application.GetRealWidth(36),
+                Height = Application.GetRealHeight(17),
+                Text = "(1/20)",
+                TextSize = TextSize.text12,
+                TextColor = CSS.CSS_Color.textCancelColor,
+            };
+            fLayout.AddChidren(sumBtn);
+
+            //鎺у埗澶辫触
+            var failedBtn = new Button
+            {
+                Y = Application.GetRealHeight(521),
+                X = Application.GetRealWidth(52),
+                Width = Application.GetRealWidth(124),
+                Height = Application.GetRealHeight(44),
+                TextID = StringId.kongzhishibai,
+                TextSize = TextSize.text16,
+                TextColor = CSS.CSS_Color.textConfirmColor,
+                TextAlignment = TextAlignment.Center,
+                Radius = (uint)Application.GetRealHeight(44),
+                BorderWidth = 1,
+                BorderColor = CSS.CSS_Color.textConfirmColor,
+            };
+            fLayout.AddChidren(failedBtn);
+            //鎺у埗鎴愬姛
+            var succeedBtn = new Button
+            {
+                Y = Application.GetRealHeight(521),
+                X = Application.GetRealWidth(196),
+                Width = Application.GetRealWidth(124),
+                Height = Application.GetRealHeight(44),
+                TextID = StringId.kongzhichenggong,
+                TextSize = TextSize.text16,
+                TextColor = CSS.CSS_Color.textWhiteColor,
+                TextAlignment = TextAlignment.Center,
+                Radius = (uint)Application.GetRealHeight(44),
+                //BorderWidth = 1,
+                //BorderColor = CSS.CSS_Color.textConfirmColor,
+                BackgroundColor = CSS.CSS_Color.textConfirmColor,
+            };
+            fLayout.AddChidren(succeedBtn);
+            #endregion
+            #region 鐐瑰嚮浜嬩欢
+            //琛ㄧず搴撳垪琛ㄧ储寮曞��
+            int index= 1; 
+            //琛ㄧず娴嬭瘯鐮佺储寮曞��
+            int code = 1;
+            //宸�
+            leftIconBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                if (index>1) {
+                    index--;
+                    sumBtn.Text = "(" + index.ToString() + "/20)";
+                }
+                code = 1;
+                GetBtnText(testBtn, code, spk);
+            };
+            //鍙�
+            rightIconBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                if (index < 20)
+                {
+                    index++;
+                    sumBtn.Text = "(" + index.ToString() + "/20)";
+                }
+                code = 1;
+                GetBtnText(testBtn, code, spk);
+            };
+            //娴嬭瘯Text
+            testBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                var library = libraryList[index];
+                var control = GetControl(spk, testBtn.TextID, library);
+                CodeTest(control);
+            };
+            //鎺у埗澶辫触
+            failedBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                if (index < 20)
+                {
+                    index++;
+                    sumBtn.Text = "(" + index.ToString() + "/20)";
+                }
+                code = 1;
+                GetBtnText(testBtn, code, spk);
+            };
+            //鎺у埗鎴愬姛
+            succeedBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                if (code < 3)
+                {
+                    code++;
+                }
+                GetBtnText(testBtn, code, spk);
+                if (code == 3)
+                {
+                    var library = libraryList[index];
+                    var control = GetControl(spk, testBtn.TextID, library);
+                    Method method = new Method();
+                    method.ThreadAddControl(control, this,(control1) => {
+                        MainPage.BasePageView.RemoveViewByTag("PirView");
+                        AddControlComplete addControlComplete = new AddControlComplete();
+                        MainPage.BasePageView.AddChidren(addControlComplete);
+                        addControlComplete.Show(control1,true);
+                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                    });
+
+                }
+            };
+            #endregion
+        }
+
+        /// <summary>
+        /// 鑾峰彇Control瀵硅薄锛堝瓨鍌ㄥ彂閫佹暟鎹殑瀵硅薄锛�
+        /// </summary>
+        /// <param name="spk"></param>
+        /// <param name="textInt"></param>
+        /// <param name="library"></param>
+        /// <returns></returns>
+        private Control GetControl(string spk, int textInt, Library library) {
+
+            string key = "";
+            string value = "";
+            switch (spk)
+            {
+                case SPK.AcStandard:
+                    {
+                        switch (textInt)
+                        {
+                            case StringId.dianshi:
+                                {
+                                    key = "on_off";
+                                    value = "on";
+                                }
+                                break;
+                            case StringId.moshizhileng:
+                                {
+                                    key = "mode";
+                                    value = "cool";
+                                }
+                                break;
+                            case StringId.fengsuzhongfeng:
+                                {
+                                    key = "fan";
+                                    value = "medium";
+                                }
+                                break;
+                        }
+                    }
+                    break;
+                case SPK.ElectricTV:
+                    {
+                        switch (textInt)
+                        {
+                            case StringId.dianshi:
+                                {
+                                    key = "on_off";
+                                    value = "on";
+                                }
+                                break;
+                            case StringId.yinliangjia:
+                                {
+                                    key = "on_off";
+                                    value = "on";
+                                }
+                                break;
+                            case StringId.jingyin:
+                                {
+                                    key = "mute";
+                                    value = "0";
+                                }
+                                break;
+                        }
+                    }
+                    break;
+            }
+            ButtonObj buttonObj = new ButtonObj();
+            buttonObj.Key = key;
+            buttonObj.value = value;
+
+            Control control = new Control();
+            control.spk = spk;
+            control.name = spk;
+            control.group_id = library.irIndex;
+            control.type = "library";
+            control.status.Add(buttonObj);
+            string[] strings = library.irCode.Split(',');
+            for (int array = 0; array < strings.Length; array++)
+            {
+                //var intValue = Convert.ToInt32(strings[array],16);
+                control.library.Add(strings[array]);
+            }
+
+            return control;
+        }
+
+        /// <summary>
+        /// 鍙戦�佸簱鐮佹祴璇曞懡浠�
+        /// </summary>
+        /// <param name="control"></param>
+        private void CodeTest(Control control)
+        {
+
+            //鍔犺浇log
+            Loading loading = new Loading();
+            this.AddChidren(loading);
+            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
+            loading.Start();
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    //鍙戦�佹寜閿垹闄わ紱
+                    responsePackNew = PirSend.CodeTest(control);
+                }
+                catch { }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        loading.Hide();
+                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                        {
+
+                        }
+                        else
+                        {
+                            Method method = new Method();
+                            method.ErrorShow(responsePackNew);
+                        }
+
+                    });
+                }
+
+            })
+            { IsBackground = true }.Start();
+        }
+
+        /// <summary>
+        /// 鏄剧ず娴嬭瘯鏂囨湰
+        /// </summary>
+        /// <param name="testBtn">鏄剧ず鎺т欢</param>
+        /// <param name="code">娴嬭瘯鐮佹枃鏈储寮曞��</param>
+        /// <param name="spk">浜戦泙涓婂畾涔塻pk</param>
+        private  void GetBtnText(Button testBtn,int code,string spk) {
+
+            int textValue = 0;
+            switch (spk)
+            {
+                case SPK.AcIr:
+                    {
+                        switch (code)
+                        {
+                            case 1:
+                                {
+                                    textValue = StringId.dianyuan;
+                                }
+                                break;
+                            case 2:
+                                {
+                                    textValue = StringId.moshizhileng;
+                                }
+                                break;
+                            case 3:
+                                {
+                                    textValue = StringId.fengsuzhongfeng;
+                                }
+                                break;
+                        }
+                    }
+                    break;
+                case SPK.ElectricTV:
+                    {
+                        switch (code)
+                        {
+                            case 1:
+                                {
+                                    textValue = StringId.dianyuan;
+                                }
+                                break;
+                            case 2:
+                                {
+                                    textValue = StringId.yinliangjia;
+                                }
+                                break;
+                            case 3:
+                                {
+                                    textValue = StringId.jingyin;
+                                }
+                                break;
+                        }
+                    }
+                    break;
+            }
+            testBtn.TextID = textValue;
+        }
+    }
+}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index 0c7d14f..0bc89c6 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -1,6 +1,8 @@
 锘縰sing System;
 using HDL_ON.DAL.Server;
 using Shared;
+using System.Collections.Generic;
+using Newtonsoft.Json.Linq;
 
 namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
 {
@@ -9,37 +11,39 @@
         /// <summary>
         /// 娣诲姞閬ユ帶鍣ㄧ殑鏂规硶
         /// </summary>
-        public void AddControl()
+        public void AddControl(FrameLayout frameLayout, Action<Control> action)
         {
             View.TipView tipView = new View.TipView();
-            tipView.InputBox("", (s, dialog) =>
-            {
-                ///娓呴櫎涔嬪墠鍒楄〃鏁版嵁
-                Pir.BuottonList.Clear();
-                if (!string.IsNullOrEmpty(s))
-                {
-                    Control control = new Control();
-                    control.name = s;
-                    control.type = "learn";
-
-                    ThreadAddControl(control,dialog);
+            tipView.InputBox(frameLayout, "", (name, frame) =>
+             {
+                 ///娓呴櫎涔嬪墠鍒楄〃鏁版嵁
+                 Pir.BuottonList.Clear();
+                 if (!string.IsNullOrEmpty(name))
+                 {
+                     Control control = new Control();
+                     control.name = name;
+                     control.type = "learn";
+                     control.spk = "ir.learn";
+                     control.deviceId = Pir.currPir.deviceId;
+                     ThreadAddControl(control, frame, action);
 
 
 
-                }
-            },false);
+                 }
+             }, false);
 
         }
         /// <summary>
         /// 鍙戦�侀仴鎺у櫒鍛戒护鏂规硶
         /// </summary>
         /// <param name="control"></param>
-        /// <param name="dialog"></param>
-        public void ThreadAddControl(Control control, Dialog dialog) {
+        /// <param name="frame"></param>
+        public void ThreadAddControl(Control control, FrameLayout frame, Action<Control> action)
+        {
 
             DAL.Server.ResponsePackNew responsePackNew = null;
             Loading loading = new Loading();
-            dialog.AddChidren(loading);
+            frame.AddChidren(loading);
             loading.Start();
             new System.Threading.Thread(() =>
             {
@@ -53,37 +57,235 @@
                     Application.RunOnMainThread(() =>
                     {
                         loading.Hide();
-                        //if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                        //{
-                            ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔�
-                            dialog.Close();//娣诲姞鎴愬姛鍏抽棴寮圭獥
-                            AddButton addButton = new AddButton();
-                            MainPage.BasePageView.AddChidren(addButton);
-                            addButton.Show(control);
-                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                        {
+                            bool bool_if = false;
+                            string sid = responsePackNew.Data.ToString();
+                            var mqttdate = MqttDate();
+                            for (int i = 0; i < mqttdate.objects.Count; i++) {
+                                var objects = mqttdate.objects[i];
+                                if (sid == objects.sid) {
+                                    bool_if = true;
+                                    break;
+                                }
+                            }
+                            if (bool_if)
+                            {
+                                control.deviceId = mqttdate.id;
+                                ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔�
+                                frame.RemoveFromParent();//娣诲姞鎴愬姛鍏抽棴寮圭獥
+                                action(control);
+                            }
+                            else
+                            {
+                                //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀�
+                                View.FailView failView = new View.FailView();
+                                failView.ShouError((view) =>
+                                {
+                                    view.Close();
+                                    ThreadAddControl(control, frame, action);
+                                });
+                            }
 
-                            //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀�
-                            //View.FailView failView = new View.FailView();
-                            //failView.ShouError((view) => {
-                            //    view.Close();
-                            //    ThreadAddControl(control, dialog);
-                            //});
-                        //}
-                        //else
-                        //{
-                        //    ErrorShow(responsePackNew);
-                        //}
+
+                        }
+                        else
+                        {
+                            ErrorShow(responsePackNew);
+                        }
                     });
                 }
             })
             { IsBackground = true }.Start();
 
         }
+
+        /// <summary>
+        /// 鑾峰彇绾㈠璁惧鍒楄〃
+        /// </summary>
+        public static void GetPirDeviceList(FrameLayout frame, Action action)
+        {
+            //娓呴櫎涔嬪墠鍒楄〃;
+            Pir.pirDeviceList.Clear();
+            //鍔犺浇log
+            Loading loading = new Loading();
+            frame.AddChidren(loading);
+            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
+            loading.Start();
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    responsePackNew = PirSend.GetDeviceList("ir.module");
+                }
+                catch { }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        loading.Hide();
+                        try
+                        {
+                            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                            {
+                                var jobject = Newtonsoft.Json.Linq.JObject.Parse(responsePackNew.Data.ToString());
+                                string list = jobject["list"].ToString();
+
+                                var jArray = Newtonsoft.Json.Linq.JArray.Parse(list);
+                                for (int a = 0; a < jArray.Count; a++)
+                                {
+                                    var jay = jArray[a];
+                                    string spk = jay["spk"].ToString();
+                                    if (spk == "ir.module")
+                                    {
+                                        //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
+                                        var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
+                                        var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Pir>(str);
+                                        if (pirJosn != null)
+                                        {
+                                            if (null == Pir.pirDeviceList.Find((c) => c.deviceId == pirJosn.deviceId))
+                                            {
+
+                                                Pir.pirDeviceList.Add(pirJosn);
+
+                                            }
+                                        }
+                                    }
+
+                                }
+                                GetControlList(frame, action);
+
+                            }
+                            else
+                            {
+                                Method method = new Method();
+                                method.ErrorShow(responsePackNew);
+                            }
+                        }
+                        catch { }
+
+                    });
+                }
+
+            })
+            { IsBackground = true }.Start();
+
+        }
+        /// <summary>
+        /// 鑾峰彇閬ユ帶鍣ㄥ垪琛�
+        /// </summary>
+        public static void GetControlList(FrameLayout frame, Action action)
+        {
+            //鍔犺浇log
+            Loading loading = new Loading();
+            frame.AddChidren(loading);
+            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
+            loading.Start();
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    for (int i = 0; i < Pir.pirDeviceList.Count; i++)
+                    {
+                        var pirDevice = Pir.pirDeviceList[i];
+                        try
+                        {
+                            responsePackNew = PirSend.ControlList(pirDevice);
+
+                        }
+                        catch { }
+                        finally
+                        {
+                            Application.RunOnMainThread(() =>
+                            {
+                                try
+                                {
+                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                                    {
+                                        var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
+                                        for (int a = 0; a < jArray.Count; a++)
+                                        {
+                                            var jay = jArray[a];
+                                            //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
+                                            var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
+                                            var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
+                                            if (pirJosn != null)
+                                            {
+                                                if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid))
+                                                {
+                                                    pirDevice.FunctioList.Add(pirJosn);
+                                                }
+                                            }
+
+                                        }
+                                    }
+                                    else
+                                    {
+                                        //Method method = new Method();
+                                        //method.ErrorShow(responsePackNew);
+                                    }
+                                }
+                                catch { }
+
+                            });
+                        }
+                    }
+                }
+                catch { }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        loading.Hide();
+                        action();
+                    });
+                }
+            })
+            { IsBackground = true }.Start();
+
+        }
+
+        /// <summary>
+        /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁(閬ユ帶鍣ㄦ坊鍔�)
+        /// </summary>
+        public static string addcontronsid = "";
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        public Cloud MqttDate()
+        {
+            var dateTime = DateTime.Now;
+            while ((DateTime.Now - dateTime).TotalMilliseconds < 5 * 1000)
+            {
+                if (!string.IsNullOrEmpty(addcontronsid))
+                {
+                    break;
+                }
+
+            }
+            return PushData();
+        }
+
+        public Cloud PushData()
+        {
+            Cloud cloud = new Cloud();
+            if (addcontronsid != "")
+            {
+                //var date = Newtonsoft.Json.JsonConvert.SerializeObject(addcontronsid);
+                cloud = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud>(addcontronsid);
+
+            }
+            return cloud;
+        }
+
+
+
         /// <summary>
         /// 閿欒鐮佹彁绀�
         /// </summary>
         /// <param name="responsePackNew"></param>
-        public  void ErrorShow(ResponsePackNew responsePackNew)
+        public void ErrorShow(ResponsePackNew responsePackNew)
         {
 
             if (responsePackNew != null && responsePackNew.Code == "14005")
@@ -97,5 +299,25 @@
 
             }
         }
+
     }
+    [Serializable]
+    public class Cloud
+    {
+        /// <summary>
+        /// 璁惧id
+        /// </summary>
+        public string id = string.Empty;
+        public List<Objects> objects = new List<Objects>();
+        public string time_stamp = string.Empty;
+
+
+    }
+    [Serializable]
+    public class Objects
+    {
+        public string sid = string.Empty;
+        public string spk = string.Empty;
+    }
+
 }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
index 23d3c91..e985b71 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
@@ -2,22 +2,27 @@
 using System.Collections.Generic;
 namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
 {
-    public class Pir
+    [System.Serializable]
+    public class Pir: Entity.Function
     {
         /// <summary>
         /// 娣诲姞鎸夐敭鍒楄〃
         /// </summary>
         public static List<ButtonObj> BuottonList = new List<ButtonObj>();
+        public static List<Pir> pirDeviceList = new List<Pir>();
+        /// <summary>
+        /// 褰撳墠閫昏緫
+        /// </summary>
+        public static Pir currPir;
+        /// <summary>
+        /// 閬ユ帶鍣ㄥ垪琛�
+        /// </summary>
+        public List<Entity.Function> FunctioList = new List<Entity.Function>();
 
     }
-    public class ButtonObj
-    {
-        public string Key = string.Empty;
-        /// <summary>
-        /// #app 鏄剧ず鐨勬枃瀛�
-        /// </summary>
-        public string value = string.Empty;
-    }
+   
+
+    [System.Serializable]
     public class Control
     {
         /// <summary>
@@ -44,5 +49,65 @@
         /// 绾㈠鐮�
         /// </summary>
         public List<string> library = new List<string>();
+        /// <summary>
+        /// 绾㈠鐮�
+        /// </summary>
+        public List<ButtonObj> status = new List<ButtonObj>();
     }
+    [System.Serializable]
+    public class ButtonObj
+    {
+        public string Key = string.Empty;
+        /// <summary>
+        /// #app 鏄剧ず鐨勬枃瀛�
+        /// </summary>
+        public string value = string.Empty;
+    }
+    [System.Serializable]
+    public class DeviceType
+    {
+        /// <summary>
+        /// 璁惧绫诲瀷涓婚敭Id
+        /// </summary>
+        public string id = string.Empty;
+        /// <summary>
+        /// 璁惧绫诲瀷(鎶曞奖浠�,椋庢墖,鏈洪《鐩�...)
+        /// </summary>
+        public string deviceType = string.Empty;
+    }
+    [System.Serializable]
+    public class Brand
+    {
+        /// <summary>
+        /// 鍝佺墝涓婚敭Id
+        /// </summary>
+        public string id = string.Empty;
+        /// <summary>
+        /// 璁惧绫诲瀷涓婚敭Id
+        /// </summary>
+        public string deviceTypeId = string.Empty;
+        /// <summary>
+        /// 鍝佺墝鍚嶇О
+        /// </summary>
+        public string brandName = string.Empty;
+
+    }
+
+    public class Library
+    {
+        /// <summary>
+        /// 绾㈠鐮�
+        /// </summary>
+        public string irCode = string.Empty;
+        /// <summary>
+        /// 鍝佺墝涓婚敭Id
+        /// </summary>
+        public string brandId = string.Empty;
+        /// <summary>
+        /// 绾㈠鐮佺储寮曞簭鍙�
+        /// </summary>
+        public string irIndex = string.Empty;
+
+    }
+
 }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
index 9da222a..902b7ee 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using System.Collections.Generic;
+using HDL_ON.Entity;
 using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
 using Shared;
 namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
@@ -8,8 +9,13 @@
     {
         public PirMain()
         {
-            Tag = "PirView";
+            Tag = "PirMain";
+        
         }
+        /// <summary>
+        /// 涓存椂鍌ㄥ瓨璁惧绫诲瀷鍒楄〃
+        /// </summary>
+        List<DeviceType> DeviceTypeList = new List<DeviceType>();
         public void Show()
         {
             #region 鐣岄潰甯冨眬
@@ -43,9 +49,9 @@
                 TextColor = CSS.CSS_Color.textConfirmColor,
                 TextAlignment = TextAlignment.CenterLeft,
                 TextID = StringId.shebeigaunli,
-                IsBold=true,
+                IsBold = true,
             };
-            pirDeviceFLayout.AddChidren(text1Btn); 
+            pirDeviceFLayout.AddChidren(text1Btn);
 
 
             Button pirIcon = new Button
@@ -129,7 +135,8 @@
             ///绾㈠瀹濈偣鍑讳簨浠�
             FrameLayout clickFLayout = new FrameLayout();
             pirDeviceFLayout.AddChidren(clickFLayout);
-            clickFLayout.MouseUpEventHandler += (sender,e) => {
+            clickFLayout.MouseUpEventHandler += (sender, e) =>
+            {
 
                 DeviceSet deviceSet = new DeviceSet();
                 MainPage.BasePageView.AddChidren(deviceSet);
@@ -160,7 +167,7 @@
             };
             deviceListFLayout.AddChidren(text3Btn);
             ///绾㈠瀹濆悕绉�
-            Button deviceNameBtn= new Button
+            Button deviceNameBtn = new Button
             {
                 Y = Application.GetRealHeight(13),
                 X = Application.GetRealWidth(161),
@@ -172,17 +179,108 @@
                 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
             {
                 Y = Application.GetRealHeight(13),
-                X = Application.GetRealWidth(343-8-16),
+                X = Application.GetRealWidth(343 - 8 - 16),
                 Width = Application.GetRealWidth(16),
                 Height = Application.GetRealWidth(16),
                 UnSelectedImagePath = "PirIcon/dropdown.png",
             };
             deviceListFLayout.AddChidren(dropdownIconBtn);
+
+            deviceNameBtn.MouseUpEventHandler += (sender, e) =>
+            {
+
+                #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
+
+                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;
+                    }
+                }
+
+            };
 
             #endregion
             int line = 0;
@@ -206,9 +304,9 @@
                     UnSelectedImagePath = "PirIcon/Infraredtreasure.png",
                 };
                 currpirdeviceFLayout.AddChidren(deviceIconBtn);
-                var iconNameBtn = new Button  
+                var iconNameBtn = new Button
                 {
-                    Y = deviceIconBtn.Bottom+Application.GetRealHeight(8),
+                    Y = deviceIconBtn.Bottom + Application.GetRealHeight(8),
                     Width = Application.GetRealWidth(80),
                     Height = Application.GetRealHeight(17),
                     TextSize = TextSize.text12,
@@ -227,68 +325,163 @@
                 GetIconAndText(i, deviceIconBtn, iconNameBtn);
                 clickBtn.MouseUpEventHandler += (sender, e) =>
                 {
+
                     //1=绌鸿皟;2=鐢佃;3=椋庢墖;4=鏈洪《鐩�;5=DVD/EVD/VCD;6=鎶曞奖浠�;7=鑷畾涔�;
-                    int if_value =int.Parse(clickBtn.Tag.ToString());
-                    var list11 = new List<string> {
-                       "鐖变綘", "鍝庡懄","鍩冨強","鍝堝紬鎹㈠3鍝堝紬", "鐖卞痉鍗庡v","淇哄嚑涓柉浜�",
-                        "鎷滀簡", "宸村+", "鐧惧か",  "鐧惧悎鍦扮悊璇句綘鎵撶畻", "涓嶅害鑰侀浼忔灔", "姣斿埌涔濈偣",
-                        "杞︾珯","娴嬭瘯","姝ゅ湴", "鎵嶇湅瑙佸ソ寰楀揩","鍚冭蒋楗�","浠庣湅瑙佷簩鍗佸",
-                       "绛夊緟鏈轰細鍚�","鐨勫鎴�", "澶氬枬鐐�", "鐧昏鍝︾劧鍚�", "鎵撶數璇�",
-                         "鎭╄偆闇滅湅灏辩湅浜�", "楗挎os","鎭堕瓟鍩�","鍎跨鑱斿姩", "鎭╁叚棰楀瓙寮规媺鎷夎¥娲楁尽浜�","鍙戝ぇ瀛︾敓鍙戝彂",
-                        "鐪熷帀瀹砳鍙戝灏�", "鐭ラ亾浣犱粯娆句簡鍙�", "灏厭鍥炲",  "鏀硅繘鐨勮瘽", "澶╁ぉ閫熷害鍥炵瓟", "澶ソ浜嗗紑杞�",
-                        "鍑忚偉鐨勭湅杩�","妗″嚭鍙e閭�","濡傛灉瑙夊緱", "寰堣垝鏈嶇殑","鍚冭蒋楗�","浠庣湅瑙佷簩鍗佸",
-                       "榫欏嵎椋庝簭澶у彂","鍘诲ソ鐪�", "澶氬枬鐐�", "濂芥氮璐瑰ソ", "鎵撶數璇�"};
-                    System.Threading.Tasks.Task.Run(() =>
+                    int if_value = int.Parse(clickBtn.Tag.ToString());
+                    if (if_value == 7)
                     {
-                        Application.RunOnMainThread(() =>
+                        Method method = new Method();
+                        method.AddControl(this, (control) =>
                         {
-                            switch (if_value)
+                            AddButton addButton = new AddButton();
+                            MainPage.BasePageView.AddChidren(addButton);
+                            addButton.Show(control);
+                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                        });
+                    }
+                    else
+                    {
+                        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++)
                             {
-                                case 1:
-                                    {
-                                    }
-                                    break;
-                                case 2:
-                                    {
-                                    }
-                                    break;
-                                case 3:
-                                    {
-                                    }
-                                    break;
-                                case 4:
-                                    {
-                                    }
-                                    break;
-                                case 5:
-                                    {
-                                    }
-                                    break;
-                                case 6:
-                                    {
-                                    }
-                                    break;
-                                case 7:
-                                    {
-                                        Method method = new Method();
-                                        method.AddControl();
-                                       
-                                    }
-                                    break;
+                                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;
+                            });
 
-                            //BrandList brandList = new BrandList();
-                            //MainPage.BasePageView.AddChidren(brandList);
-                            //brandList.Show(list11, null);
-                            //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                         });
-                    });
+
+                    }
+
+
                 };
 
             }
+            GetDeviceTypeList();
 
+        }
+        /// <summary>
+        /// 鑾峰彇鍝佺墝鏀寔
+        /// </summary>
+        /// <param name="index">绱㈠紩鍊�</param>
+        private List<string> GetBrandSupport(int index)
+        {
+            List<string> strList = new List<string>();
+            switch (index)
+            {
+                case 1:
+                    {
+                        strList.Add("鏍煎姏");
+                        strList.Add("缇庣殑");
+                        strList.Add("娴峰皵");
+                        strList.Add("鏉句笅");
+                        strList.Add("娴蜂俊");
+                        strList.Add("闀胯櫣");
+                    }
+                    break;
+                case 2:
+                    {
+                        strList.Add("鍒涚淮");
+                        strList.Add("TCL");
+                        strList.Add("娴蜂俊");
+                        strList.Add("闀胯櫣");
+                        strList.Add("娴峰皵");
+                        strList.Add("涓夋槦");
+                        strList.Add("涔愯");
+                        strList.Add("绱㈠凹");
+                        strList.Add("LG涔愰噾");
+                    }
+                    break;
+                case 3:
+                    {
+                    }
+                    break;
+                case 4:
+                    {
+                    }
+                    break;
+                case 5:
+                    {
+                    }
+                    break;
+                case 6:
+                    {
+                    }
+                    break;
+
+
+            }
+            return strList;
+        }
+        /// <summary>
+        /// 鑾峰彇璁惧绫诲瀷str
+        /// </summary>
+        /// <param name="index">绱㈠紩鍊�</param>
+        private string GetTypeString(int index)
+        {
+            string type = "";
+            switch (index)
+            {
+                case 1:
+                    {
+                        //绌鸿皟
+                        type = "ac-" + SPK.AcIr;
+                    }
+                    break;
+                case 2:
+                    {
+                        //鐢佃
+                        type = "tv-" + SPK.ElectricTV;
+                    }
+                    break;
+                case 3:
+                    {
+                        //椋庢墖
+                        type = "fan-" + SPK.ElectricFan;
+                    }
+                    break;
+                case 4:
+                    {
+                        //鏈洪《鐩�
+                        //  type = "set_top_box-" + SPK.ElectricTV;
+                    }
+                    break;
+                case 5:
+                    {
+                        //褰辩鏈�
+                        // type = "dvd-" + SPK.ElectricTV;
+                    }
+                    break;
+                case 6:
+                    {
+                        //鎶曞奖浠�
+                        //  type = "projector-" + SPK.ElectricTV;
+                    }
+                    break;
+
+
+            }
+            return type;
         }
         /// <summary>
         /// 璁剧疆鍥剧墖鍜屽娉�
@@ -296,44 +489,129 @@
         /// <param name="index">绱㈠紩鍊�</param>
         /// <param name="deviceIconBtn">鍥炬爣Btn</param>
         /// <param name="deviceNameBtn">璁惧澶囨敞Btn</param>
-        private void GetIconAndText(int index,Button deviceIconBtn, Button deviceNameBtn) {
-            string iconPath = "";  
-            int deviceNameIndex=0;
+        private void GetIconAndText(int index, Button deviceIconBtn, Button deviceNameBtn)
+        {
+            string iconPath = "";
+            int deviceNameIndex = 0;
             switch (index)
             {
-                case 1: {
+                case 1:
+                    {
                         iconPath = "PirIcon/air.png";
                         deviceNameIndex = StringId.kongtiao;
-                    } break;
-                case 2: {
+                    }
+                    break;
+                case 2:
+                    {
                         iconPath = "PirIcon/tv.png";
                         deviceNameIndex = StringId.dianshi;
-                    } break;
-                case 3: {
+                    }
+                    break;
+                case 3:
+                    {
                         iconPath = "PirIcon/fan.png";
                         deviceNameIndex = StringId.fengshan;
-                    } break;
-                case 4: {
+                    }
+                    break;
+                case 4:
+                    {
                         iconPath = "PirIcon/stb.png";
                         deviceNameIndex = StringId.jidinghe;
-                    } break;
-                case 5: {
+                    }
+                    break;
+                case 5:
+                    {
                         iconPath = "PirIcon/dvd.png";
                         deviceNameIndex = StringId.dvd;
-                    } break;
-                case 6: {
+                    }
+                    break;
+                case 6:
+                    {
                         iconPath = "PirIcon/projector.png";
                         deviceNameIndex = StringId.touyingyi;
-                    } break;
-                case 7: {
+                    }
+                    break;
+                case 7:
+                    {
                         iconPath = "PirIcon/custom.png";
                         deviceNameIndex = StringId.zidingyi;
-                    } break;
+                    }
+                    break;
 
             }
             deviceIconBtn.UnSelectedImagePath = iconPath;
             deviceNameBtn.TextID = deviceNameIndex;
         }
-        
+        /// <summary>
+        /// 璇诲彇绾㈠璁惧绫诲瀷鍒楄〃
+        /// </summary>
+        private void GetDeviceTypeList()
+        {
+            PirSend.GetDeviceTypesList(this, (responsePackNew) =>
+            {
+
+                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                {
+                    //娓呯┖涔嬪墠鏁版嵁
+                    DeviceTypeList.Clear();
+                    var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
+                    for (int a = 0; a < jArray.Count; a++)
+                    {
+                        var jay = jArray[a];
+                        var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
+                        var objDeviceType = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceType>(str);
+                        if (objDeviceType != null)
+                        {
+                            if (null == DeviceTypeList.Find((c) => c.id == objDeviceType.id))
+                            {
+                                DeviceTypeList.Add(objDeviceType);
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    Method method = new Method();
+                    method.ErrorShow(responsePackNew);
+                }
+            }, "", "璁惧绫诲瀷鍒楄〃");
+        }
+        /// <summary>
+        /// 璇诲彇绾㈠璁惧绫诲瀷鐨勫搧鐗屽垪琛�
+        /// </summary>
+        private void GetBrandList(string id, Action<List<Brand>> actionBrand)
+        {
+            List<Brand> brandList = new List<Brand>();
+            PirSend.GetDeviceTypesList(this, (responsePackNew) =>
+            {
+
+                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                {
+                    //娓呯┖涔嬪墠鏁版嵁
+                    brandList.Clear();
+                    var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
+                    for (int a = 0; a < jArray.Count; a++)
+                    {
+                        var jay = jArray[a];
+                        var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
+                        var brand = Newtonsoft.Json.JsonConvert.DeserializeObject<Brand>(str);
+                        if (brand != null)
+                        {
+                            if (null == brandList.Find((c) => c.id == brand.id))
+                            {
+                                brandList.Add(brand);
+                            }
+                        }
+                    }
+                    actionBrand(brandList);
+                }
+                else
+                {
+                    Method method = new Method();
+                    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 abb0874..6c253dc 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -11,6 +11,8 @@
 
     public class PirSend
     {
+
+        public static string pirId = "1367032976869658625"; 
         /// <summary>
         /// 浣忓畢ID
         /// </summary>
@@ -32,8 +34,36 @@
             }
         }
         /// <summary>
+        /// 鑾峰彇璁惧鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public static ResponsePackNew GetDeviceList(string spk)
+        {
+            var jObject = new JObject { };
+            jObject.Add("homeId", HomeId);
+            jObject.Add("spk", spk);
+            //d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId);
+            //d.Add("roomId", DB_ResidenceData.residenceData.residecenInfo.RegionID);//鍙帶鍙傛暟锛屽綋闇�瑕佸垎椤佃幏鍙栵紝鎬庝箞鐭ラ亾鍒嗛〉鎬绘暟
+            //d.Add("searchType", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+            //d.Add("pageSize", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+            //d.Add("pageNo", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.Api_Post_GetDevcieList);
+            return responsePackNew;
+        }
+        /// <summary>
+        /// 鑾峰彇閬ユ帶鍣ㄥ垪琛�
+        /// </summary>
+        public static ResponsePackNew ControlList(Pir pir)
+        {
+            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId } };
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_List);
+            return responsePackNew;
+        }
+        /// <summary>
         /// 閬ユ帶鍣ㄦ坊鍔�
         /// </summary>
+        /// <returns></returns>
+        /// <param name="control"></param>
         /// <returns></returns>
         public static ResponsePackNew Add(Control control)
         {
@@ -41,11 +71,11 @@
             jObject.Add("homeId", HomeId);
             jObject.Add("deviceId", control.deviceId);
             jObject.Add("name", control.name);
-            jObject.Add("spk", "ir.module");
+            jObject.Add("spk", control.spk);
             jObject.Add("type", control.type);
-            if (control.type == "library")
+            if (control.type=="library")
             {
-                //jObject.Add("group_id", "123");
+                jObject.Add("group_id", control.group_id);
                 var libraryjay = new JArray { };
                 for (int i = 0; i < control.library.Count; i++)
                 {
@@ -53,9 +83,43 @@
                 }
                 jObject.Add("library", libraryjay);
             }
+          
             var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_Add);
             return responsePackNew;
         }
+        /// <summary>
+        ///绾㈠鐮佸簱璇曠爜
+        /// </summary>
+        /// <returns></returns>
+        public static ResponsePackNew CodeTest(Control control)
+        {
+            var jObject = new JObject { }; 
+            jObject.Add("homeId", HomeId);
+            jObject.Add("deviceId", control.deviceId);
+            jObject.Add("spk", control.spk);
+            if (control.spk== Entity.SPK.AcStandard) {
+                jObject.Add("group_id", control.group_id);
+            }
+            var libraryJay = new JArray { }; 
+            for (int i = 0; i < control.library.Count; i++)
+            {
+                libraryJay.Add(control.library[i]);
+            }
+            var statusJay = new JArray { };
+            for (int i = 0; i < control.status.Count; i++)
+            {
+                var statusJob = new JObject { };
+                var job = control.status[i];
+                statusJob.Add("key", job.Key);
+                statusJob.Add("value", job.value);
+                statusJay.Add(statusJob);
+            }
+            jObject.Add("library", libraryJay);
+            jObject.Add("status", statusJay);
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeTest);
+            return responsePackNew;
+        }
+        /// <summary>
         /// <summary>
         /// 绾㈠鐮佸涔�
         /// </summary>
@@ -77,7 +141,7 @@
             job.Add("value", valuejArray);
             var jArray = new JArray { };
             jArray.Add(job);
-            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "attributes", jArray } };
+            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } };
             ResponsePackNew responsePackNew = null;
             new System.Threading.Thread(() =>
             {
@@ -113,34 +177,78 @@
             job.Add("value", valuejArray);
             var jArray = new JArray { };
             jArray.Add(job);
-            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "attributes", jArray } };
+            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pirId }, { "attributes", jArray } };
             var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove);
             return responsePackNew;
         }
+
         /// <summary>
-        /// 鑾峰彇閫昏緫
+        /// 绾㈠瀹�/閬ユ帶鍣ㄥ垹闄�
         /// </summary>
-        /// <param name="listIdList">閫昏緫ID鍒楄〃</param>
         /// <returns></returns>
-        public static ResponsePackNew GetLogic(List<string> listIdList)
+        public static ResponsePackNew DeleteDevice(string deviceId)
         {
-            var jArray = new JArray { };
-            for (int i = 0; i < listIdList.Count; i++)
-            {
-                jArray.Add(listIdList[i]);
-            }
-            var jObject = new JObject { { "userLogicIds", jArray } };
-            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info);
-            //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
-            if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
-            {
-                RefreshToken();
-                GetLogic(listIdList);
-            }
+            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", deviceId } };
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceDel);
             return responsePackNew;
         }
+        /// <summary>
+        /// 淇敼绾㈠瀹濆悕绉�
+        /// </summary>
+        /// <returns></returns>
+        public static ResponsePackNew DeviceRename(Pir  pir)
+        {
+            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", pir.deviceId }, { "name", pir.name } };
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceRename);
+            return responsePackNew;
+        }
+        /// <summary>
+        /// 鏌ヨ绾㈠璁惧绫诲瀷鍒楄〃/鍝佺墝鍒楄〃/鍝佺墝绾㈠鐮佸簱鍒楄〃
+        /// </summary>
+        /// <param name="frameLayout">鍔犺浇log鐨勭埗鎺т欢</param>
+        /// <param name="action">鍥炶皟鍑芥暟</param>
+        public static void GetDeviceTypesList(FrameLayout frameLayout, Action<ResponsePackNew> action, string id, string if_str)
+        {
 
-       
+            DAL.Server.ResponsePackNew responsePackNew = null;
+            Loading loading = new Loading();
+            frameLayout.AddChidren(loading);
+            loading.Start();
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    string url = "";
+                    var jObject = new JObject { };
+                    if (if_str == "璁惧绫诲瀷鍒楄〃")
+                    {
+                        url = "/smart-footstone/app/ir/device-type/list";
+                    }
+                    else if (if_str == "鍝佺墝鍒楄〃")
+                    {
+                        url = "/smart-footstone/app/ir/brand/list";
+                        jObject.Add("deviceTypeId", id);
+                    }
+                    else if (if_str == "鍝佺墝绾㈠鐮佸簱鍒楄〃")
+                    {
+                        url = "/smart-footstone/app/ir/code/list";
+                        jObject.Add("brandId", id);
+                    }
+                    responsePackNew = RequestServerhomeId(jObject, url);
+                }
+                catch { }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        loading.Hide();
+                        action(responsePackNew);
+                    });
+                }
+            })
+            { IsBackground = true }.Start();
+
+        }
 
         /// <summary>
         ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛� 
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirNameView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirNameView.cs
new file mode 100644
index 0000000..33dc4df
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirNameView.cs
@@ -0,0 +1,59 @@
+锘縰sing System;
+using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
+using Shared;
+namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View
+{
+   
+    public class PirNameView
+    {
+        /// <summary>
+        /// 涓绘帶浠�
+        /// </summary>
+        public FrameLayout frameLayout = new FrameLayout
+        {
+            Width = Application.GetRealWidth(144),
+            Height = Application.GetRealHeight(44),
+        };
+        /// <summary>
+        /// 鍚嶇О
+        /// </summary>
+        public Button btnName = new Button 
+        {
+            Width = Application.GetRealWidth(144-38),
+            Height = Application.GetRealHeight(20),
+            X = Application.GetRealWidth(19),
+            TextAlignment = TextAlignment.Center,
+            Gravity = Gravity.CenterVertical,
+            TextSize = TextSize.text14,
+            TextColor = CSS.CSS_Color.textColor,
+
+        };
+        /// <summary>
+        /// 绾�
+        /// </summary>
+        public Button btnLine = new Button
+        {
+            Width = Application.GetRealWidth(144-32),
+            X = Application.GetRealWidth(16),
+            Height = 1,
+            BackgroundColor = CSS.CSS_Color.viewLine,
+        };
+        public Button btnClick = new Button
+        {
+            Width = Application.GetRealWidth(144),
+            Height = Application.GetRealHeight(44),
+        };
+        /// <summary>
+        /// View鐨勬柟娉�
+        /// </summary>
+        /// <returns></returns>
+        public FrameLayout FLayoutView()
+        {
+            frameLayout.AddChidren(btnName);
+            btnLine.Y = frameLayout.Height - 1;
+            frameLayout.AddChidren(btnLine);
+            frameLayout.AddChidren(btnClick);
+            return frameLayout;
+        }
+    }
+}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs
index 5d70028..b86395d 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs
@@ -171,8 +171,161 @@
 
         }
 
+        /// <summary>
+        /// 杈撳叆妗�
+        /// </summary>
+        /// <param name="confirmAction">鍥炶皟鍑芥暟</param>
+        public void InputBox(FrameLayout frameLayout,string tnputEditTxet, Action<string, FrameLayout> confirmAction, bool if_bool = true)
+        {
+            FrameLayout frame = new FrameLayout() 
+            {
+                BackgroundColor = MusicColor.PopupBackgroundColor,
+            };
+            frameLayout.AddChidren(frame);
+            FrameLayout whiteView = new FrameLayout()
+            {
+                //Gravity = Gravity.Center,
+                X = Application.GetRealWidth(53),
+                Y = Application.GetRealHeight(264),
+                Width = Application.GetRealWidth(270),
+                Height = Application.GetRealHeight(201),
+                BackgroundColor = MusicColor.WhiteColor,
+                BorderColor = 0x00000000,
+                BorderWidth = 0,
+                Radius = (uint)Application.GetRealHeight(RradiusFrameLayout),
+            };
+            frame.AddChidren(whiteView);
 
-       
+            Button btnTitle = new Button()
+            {
+                Y = Application.GetRealHeight(20),
+                X = Application.GetRealWidth(35),
+                Height = Application.GetRealHeight(22),
+                Width = Application.GetRealWidth(200),
+                TextColor = MusicColor.SelectedColor,
+                TextSize = TextSize.Text16,
+                TextAlignment = TextAlignment.Center,
+                TextID = StringId.shuruyaokongqimingcheng,
+
+            };
+            whiteView.AddChidren(btnTitle);
+
+            FrameLayout editBjView = new FrameLayout()
+            {
+                // Gravity = Gravity.CenterHorizontal,
+                Y = btnTitle.Bottom + Application.GetRealHeight(16),
+                X = Application.GetRealWidth(24),
+                Width = Application.GetRealWidth(222),
+                Height = Application.GetRealHeight(40),
+                BackgroundColor = MusicColor.ViewColor,
+                BorderColor = 0x00000000,
+                BorderWidth = 0,
+                Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout),
+            };
+            whiteView.AddChidren(editBjView);
+
+            EditText editText = new EditText()
+            {
+                X = Application.GetRealWidth(12),
+                Y = Application.GetRealHeight(10),
+                Width = Application.GetRealWidth(160),
+                Height = Application.GetRealHeight(20),
+                Text = tnputEditTxet,
+                TextColor = MusicColor.TextColor,
+                TextSize = TextSize.Text14,
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            editBjView.AddChidren(editText);
+
+            Button clearIconBtn = new Button
+            {
+                X = Application.GetRealWidth(194),
+                Y = Application.GetRealHeight(8),
+                Width = Application.GetRealWidth(24),
+                Height = Application.GetRealWidth(24),
+                UnSelectedImagePath = "MusicIcon/clear.png",
+            };
+            editBjView.AddChidren(clearIconBtn);
+            clearIconBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                editText.Text = "";
+            };
+
+
+            Button btnTipText = new Button
+            {
+                X = Application.GetRealWidth(24),
+                Y = editBjView.Bottom + Application.GetRealHeight(12),
+                Width = Application.GetRealWidth(211),
+                Height = Application.GetRealHeight(35),
+                Text = Language.StringByID(StringId.fengleichazhao).Replace("{\\r\\n}", "\r\n"),
+                IsMoreLines = true,
+                TextColor = MusicColor.MusicNoTxetColor,
+                TextSize = TextSize.Text12,
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            whiteView.AddChidren(btnTipText);
+
+            Button btnLine = new Button()
+            {
+                Y = whiteView.Height - Application.GetRealHeight(44 + 1),
+                Height = Application.GetRealHeight(1),
+                BackgroundColor = MusicColor.LineColor,
+            };
+            whiteView.AddChidren(btnLine);
+
+            Button btnCancel = new Button()
+            {
+                Y = btnLine.Bottom,
+                Width = Application.GetRealWidth(135),
+                Height = Application.GetRealHeight(44),
+                TextAlignment = TextAlignment.Center,
+                TextColor = MusicColor.TextCancelColor,
+                TextSize = TextSize.Text16,
+                TextID = StringId.cancelMusic,
+                Gravity = Gravity.BottomLeft,
+            };
+            whiteView.AddChidren(btnCancel);
+            btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft);
+
+            Button btnConfirm = new Button()
+            {
+                X = btnCancel.Right,
+                Y = btnLine.Bottom,
+                Width = Application.GetRealWidth(135),
+                Height = Application.GetRealHeight(44),
+                TextAlignment = TextAlignment.Center,
+                TextColor = MusicColor.WhiteColor,
+                IsBold = true,
+                TextSize = TextSize.Text16,
+                TextID = StringId.confirmMusic,
+                BackgroundColor = MusicColor.SelectedColor,
+                Gravity = Gravity.BottomRight,
+            };
+            whiteView.AddChidren(btnConfirm);
+            btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight);
+            btnCancel.MouseUpEventHandler += (sender, e) =>
+            {
+                frame.RemoveFromParent();
+            };
+
+
+
+            btnConfirm.MouseUpEventHandler += (sender, e) =>
+            {
+                if (string.IsNullOrEmpty(editText.Text.Trim()))
+                {
+                    return;
+                }
+                confirmAction(editText.Text.Trim(), frame);
+                if (if_bool)
+                {
+                    frame.RemoveFromParent();
+                }
+            };
+
+        }
+
 
 
     }

--
Gitblit v1.8.0