From 26355a896c2469ec65d425f48efcf450c6df904a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 22 三月 2021 09:11:49 +0800
Subject: [PATCH] Merge branch 'WJC' into temp-wxr

---
 HDL-ON_Android/Assets/Phone/.DS_Store                                          |    0 
 HDL-ON_Android/Assets/Language.ini                                             |    1 
 HDL-ON_iOS/HDL-ON_iOS.csproj                                                   |    1 
 HDL-ON_iOS/Resources/Phone/PirIcon/add.png                                     |    0 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TopView.cs                       |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs                   |   11 
 HDL_ON/HDL_ON.projitems                                                        |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs |   11 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs                 |    6 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs                             |  163 +++++---
 HDL-ON_Android/HDL-ON_Android.csproj                                           |    1 
 /dev/null                                                                      |  294 --------------
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs                             |  134 ++++++
 HDL-ON_iOS/Resources/Language.ini                                              |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs                          |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs                 |   63 --
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs                        |   59 --
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs                            |  402 ++++++++++++--------
 HDL_ON/Common/R.cs                                                             |    1 
 HDL-ON_Android/Assets/Phone/PirIcon/add.png                                    |    0 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs                            |    7 
 21 files changed, 526 insertions(+), 636 deletions(-)

diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index 60295e2..d1df129 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -1390,6 +1390,7 @@
 6074=閬ユ帶鍣ㄤ笉鑳借秴杩�10涓紵
 6075=閬ユ帶鍣ㄦ墍灞炲尯鍩�:
 6076=缂栬緫淇℃伅
+6077=鐗堟湰鍗囩骇
 
 
 6015=鍦ㄧ嚎
diff --git a/HDL-ON_Android/Assets/Phone/.DS_Store b/HDL-ON_Android/Assets/Phone/.DS_Store
index 3d41515..1875923 100644
--- a/HDL-ON_Android/Assets/Phone/.DS_Store
+++ b/HDL-ON_Android/Assets/Phone/.DS_Store
Binary files differ
diff --git a/HDL-ON_Android/Assets/Phone/PirIcon/add.png b/HDL-ON_Android/Assets/Phone/PirIcon/add.png
new file mode 100755
index 0000000..4c3b012
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/PirIcon/add.png
Binary files differ
diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj
index 0ece078..8b7cf06 100644
--- a/HDL-ON_Android/HDL-ON_Android.csproj
+++ b/HDL-ON_Android/HDL-ON_Android.csproj
@@ -965,6 +965,7 @@
     <AndroidAsset Include="Assets\Phone\FunctionIcon\EnvirSensor\1.png" />
     <AndroidAsset Include="Assets\Phone\FunctionIcon\EnvirSensor\Pm25Bg.png" />
     <AndroidAsset Include="Assets\Phone\FunctionIcon\EnvirSensor\0.png" />
+    <AndroidAsset Include="Assets\Phone\PirIcon\add.png" />
   </ItemGroup>
   <ItemGroup>
     <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" />
diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj
index 25a017d..2cf6254 100644
--- a/HDL-ON_iOS/HDL-ON_iOS.csproj
+++ b/HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -1192,6 +1192,7 @@
       <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\Pm25Icon.png" />
       <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\TempIcon.png" />
       <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\TvocIcon.png" />
+      <BundleResource Include="Resources\Phone\PirIcon\add.png" />
     </ItemGroup>
     <ItemGroup>
       <ITunesArtwork Include="iTunesArtwork" />
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index 60295e2..ae19318 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -1390,7 +1390,7 @@
 6074=閬ユ帶鍣ㄤ笉鑳借秴杩�10涓紵
 6075=閬ユ帶鍣ㄦ墍灞炲尯鍩�:
 6076=缂栬緫淇℃伅
-
+6077=鐗堟湰鍗囩骇
 
 6015=鍦ㄧ嚎
 6016=绂荤嚎
diff --git a/HDL-ON_iOS/Resources/Phone/PirIcon/add.png b/HDL-ON_iOS/Resources/Phone/PirIcon/add.png
new file mode 100755
index 0000000..4c3b012
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/PirIcon/add.png
Binary files differ
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index f759f63..7ae6f60 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -867,6 +867,7 @@
         public const int bunengchaoguo10 = 6074;
         public const int yaokongqiquyu = 6075;
         public const int bianjixinxi = 6076;
+        public const int banbenshengji = 6077;
 
 
 
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index 9b4f916..cda2265 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -343,7 +343,6 @@
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\TopView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\BrandList.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\BrandListView.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\DeviceSet.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\TipView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\AddButton.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\SaveView.cs" />
@@ -387,6 +386,7 @@
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\ShowDialog.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\EnvironmentalPage.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\EchartsOption_Pie.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\SetPir.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="$(MSBuildThisFileDirectory)DAL\" />
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
index 472d629..cf821e1 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
@@ -234,16 +234,7 @@
                     //浠h〃杩欏苟涓嶆槸鐢辨俯鎬荤殑鐣岄潰璋冪敤鐨�,鍒欏叧闂帀鍏ㄩ儴鐨勭晫闈�
                     HdlFormLogic.Current.CloseAllOpenForm();
                     //鐒跺悗鍐嶆妸娓╂�荤殑鐣岄潰new璧锋潵
-                    HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () =>
-                    {
-                        Application.RunOnMainThread(() =>
-                        {
-                            var page = new UI2.PersonalCenter.PirDevice.PirMain();
-                            MainPage.BasePageView.AddChidren(page);
-                            page.Show(newDevice);
-                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                        });
-                    });
+                    new UI2.PersonalCenter.PirDevice.Method().MainView(this, newDevice,()=> { });
                 }
             };
         }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs
index 626306a..93342c8 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs
@@ -150,16 +150,7 @@
                     switch (device.spk)
                     {
                         case SPK.IrModule:
-                            UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () =>
-                            {
-                                Application.RunOnMainThread(() =>
-                                {
-                                    var page = new UI2.PersonalCenter.PirDevice.PirMain();
-                                    MainPage.BasePageView.AddChidren(page);
-                                    page.Show(device);
-                                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                                });
-                            });
+                            new UI2.PersonalCenter.PirDevice.Method().MainView(this, device,()=> { });
                             break;
                     }
                 };
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
index 1e4c027..dba2330 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -159,7 +159,7 @@
                                 var view = MainPage.BasePageView.GetChildren(i);
                                 if (view.GetType() == typeof(AddControl))
                                 {
-                                    new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai));
+                                    new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai));
                                     view.RemoveFromParent();
                                 }
 
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
index 82105bf..801b039 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -118,53 +118,24 @@
             #endregion
             #region  鐣岄潰鐐瑰嚮浜嬩欢
             //閬ユ帶鍣ㄥ悕绉扮偣鍑讳簨浠�
-            namePatchView.btnClick.MouseUpEventHandler += (sender, e) => {
+            namePatchView.btnClick.MouseUpEventHandler += (sender, e) =>
+            {
 
                 List<string> list = new List<string>();
-
-                for (int i = 0; i < PirDevice.Pir.currPir.FunctioList.Count; i++)
+                for (int i = 0; i < Pir.currPir.FunctioList.Count; i++)
                 {
-                    list.Add(PirDevice.Pir.currPir.FunctioList[i].name);
+                    list.Add(Pir.currPir.FunctioList[i].name);
                 }
                 Method method = new Method();
-                method.EditControlName(StringId.editName, list, control.name, (name, view) =>
+                method.EditControlName(StringId.editName, list, control.name, (name, dialog) =>
                 {
-                    //鍔犺浇log
-                    Loading loading = new Loading();
-                    view.AddChidren(loading);
-                    HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-                    loading.Start();
-                    new System.Threading.Thread(() =>
+                    Method.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) =>
                     {
-                        try
-                        {
-                            responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
-                        }
-                        catch { }
-                        finally
-                        {
-                            Application.RunOnMainThread(() =>
-                            {
-                                loading.Hide();
-                                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                                {
-                                    view.Close();
-                                    namePatchView.btnText2.Text = name;
-                                    function.name = name;
-                                }
-                                else
-                                {
-                                    Method methodError = new Method();
-                                    methodError.ErrorShow(responsePackNew, "");
-                                }
+                        dialog.Close();
+                        namePatchView.btnText2.Text = name;
+                        function.name = name;
 
-                            });
-                        }
-
-                    })
-                    { IsBackground = true }.Start();
-
-
+                    }, "淇敼鍚嶇О", "dialog", null, dialog);
                 }, () => { });
             };
             //鎵�灞炲尯鍩熺偣鍑讳簨浠�
@@ -198,12 +169,16 @@
             //瀹屾垚鐐瑰嚮浜嬩欢
             saveView.btnClick.MouseUpEventHandler += (sender, e) =>
             {
-                //鍓嶉潰鐣岄潰
-               // this.RemoveFromParent();
+                //绉婚櫎鎵�鏈夌晫闈�
                 MainPage.BasePageView.RemoveViewByTag("PirView");
-                //涓荤晫闈�
-                //MainPage.BasePageView.RemoveViewByTag("PirMain");
-                
+                //绉婚櫎绾㈠瀹濇牴鐣岄潰
+                MainPage.BasePageView.RemoveViewByTag("PirMain");
+                //閲嶆柊鍔犺浇鐣岄潰
+                var page = new PirMain();
+                MainPage.BasePageView.AddChidren(page);
+                page.Show();
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
             };
             #endregion
         }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
deleted file mode 100644
index 57194ab..0000000
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
+++ /dev/null
@@ -1,294 +0,0 @@
-锘縰sing System;
-using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
-using Shared;
-using System.Collections.Generic;
-using System.Text;
-namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
-{
-    public class DeviceSet : FrameLayout
-    {
-        public DeviceSet()
-        {
-            Tag = "PirView";
-        }
-        public void Show(Action action)
-        {
-            #region 鐣岄潰甯冨眬
-            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
-            PirDevice.View.TopView topView = new View.TopView();
-            topView.topNameBtn.TextID = StringId.shebeigaunli;
-            topView.topIconBtn.Visible = true;
-            this.AddChidren(topView.FLayoutView());
-            topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
-            {
-                action();
-                this.RemoveFromParent();
-
-            };
-
-            VerticalRefreshLayout vv = new VerticalRefreshLayout();
-            vv.Height = Application.GetRealHeight(667 - 64);
-            vv.Y = Application.GetRealHeight(64);
-            this.AddChidren(vv);
-            vv.BeginHeaderRefreshingAction += () =>
-            {
-                //鍏抽棴鍒锋柊View锛�
-                vv.EndHeaderRefreshing();
-                //鑾峰彇鍒楄〃
-                Method.GetPirDeviceList(this, () =>
-                 {
-                     Application.RunOnMainThread(() =>
-                     {
-                         //鍒锋柊鐣岄潰
-                         UIView(vv);
-                     });
-                 });
-
-            };
-            #endregion
-            UIView(vv);
-            topView.clickSetBtn.MouseUpEventHandler += (sender, e) =>
-            {
-                var form = new AddMiniRemoteControlDirection1Page();
-                form.AddForm();
-                form.AddDeviceEvent += (device) =>
-                {
-                    Pir pir = new Pir();
-                    pir.name = device.name;
-                    pir.deviceId = device.deviceId;
-                    pir.sid = device.sid;
-                    Pir.pirDeviceList.Add(pir);
-                    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 * pirDevice.FunctioList.Count)),
-                };
-                vv.AddChidren(fLayout);
-                View.PirView pirView = new View.PirView();
-                //绾㈠瀹濆悕绉�
-                pirView.deviceNameBtn.Text = pirDevice.name;
-                //绾㈠瀹濆綋鍓嶆湁澶氬皯涓仴鎺у櫒
-                pirView.geBtn.Text = pirDevice.FunctioList.Count.ToString();
-                //绾㈠瀹濇槸鍚﹀湪绾�-绂荤嚎
-                if (pirDevice.online)
-                {
-                    pirView.stateIconBtn.IsSelected = true;
-                    pirView.stateTextBtn.IsSelected = true;
-                    pirView.stateTextBtn.TextID = StringId.zaixian;
-                }
-                else
-                {
-                    pirView.stateIconBtn.IsSelected = false;
-                    pirView.stateTextBtn.IsSelected = false;
-                    pirView.stateTextBtn.TextID = StringId.lixian;
-                }
-                //鏍囪绾㈠瀹�
-                pirView.clickBtn.Tag = pirDevice;
-                //绾㈠瀹濈偣鍑讳簨浠�
-                pirView.clickBtn.MouseUpEventHandler += (sender, e) =>
-                {
-                    var pirclick = (pirView.clickBtn.Tag as Pir);
-                    NewSwitchView(pirclick, vv);
-                };
-                //鍔犺浇鐣岄潰
-                pirView.Show(pirDevice.FunctioList.Count, fLayout);
-                if (Pir.pirDeviceList.Count - 1 == i)
-                {
-                    //鏈�鍚庝竴涓悗闈㈠鍔犻棿闅旇儗鏅�
-                    vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) });
-                }
-                #endregion
-
-                for (int j = 0; j < pirDevice.FunctioList.Count; j++)
-                {
-                    var control = pirDevice.FunctioList[j];
-
-                    View.ControlView controlView = new View.ControlView();
-                    controlView.Show(pirView.devfLayout, j);
-                    //閬ユ帶鍣ㄥ悕绉�
-                    controlView.nameBtn.Text = control.name;
-                    //閬ユ帶鍣ㄥ瓨鏀惧尯鍩�
-                    controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
-                    //鏍囪閬ユ帶鍣�
-                    controlView.delBtn.Tag = control;
-                    //鍒犻櫎鐐瑰嚮浜嬩欢
-                    controlView.delBtn.MouseUpEventHandler += (sender, e) =>
-                    {
-                        var Function = controlView.delBtn.Tag as Entity.Function;
-                        string text = Language.StringByID(StringId.shanchushebei) + Function.name + "?";
-                        TipPopView tipPopView = new TipPopView();
-                        tipPopView.TipBox(StringId.tip, text, (dialog) =>
-                        {
-                            Thread(dialog, (responsePackNew) =>
-                            {
-                                dialog.Close();
-                                var function = pirDevice.FunctioList.Find((c) => c.sid == Function.sid);
-                                if (function != null)
-                                {
-                                    pirDevice.FunctioList.Remove(Function);
-                                    if (Pir.currPir != null && pirDevice.sid == Pir.currPir.sid)
-                                    {
-                                        Pir.currPir.FunctioList = pirDevice.FunctioList;
-                                    }
-                                }
-                                UIView(vv);
-
-                            }, "鍒犻櫎", Function.deviceId, "");
-
-                        }, () => { }, false);
-                    };
-                    //view鐐瑰嚮浜嬩欢
-                    controlView.clickBtn.MouseUpEventHandler += (sender, e) =>
-                     {
-                         EditControl editControl = new EditControl();
-                         MainPage.BasePageView.AddChidren(editControl);
-                         editControl.Show(control, pirDevice, (device) =>
-                         {
-                             //鍥炶皟鏇存柊鍚嶅瓧/鍖哄煙
-                             controlView.nameBtn.Text = device.name;
-                             controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(device);
-
-                         });
-                         MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                     };
-                    if (j == pirDevice.FunctioList.Count - 1)
-                    {
-                        //鏈�鍚庢敼鍙樹竴涓嚎鐨勯鑹�
-                        controlView.line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence;
-                        controlView.funControlRow.LineColor = CSS.CSS_Color.viewTranslucence;
-                    }
-
-
-                }
-
-            }
-        }
-        /// <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 < PirDevice.Pir.pirDeviceList.Count; b++)
-                    {
-                        list.Add(PirDevice.Pir.pirDeviceList[b].name);
-                    }
-                    Method methodView = new Method();
-                    methodView.EditControlName(StringId.xiugaimingzi, list, pirclick.name, (name, view) =>
-                    {
-                        Thread(view, (responsePackNew) =>
-                        {
-                            pirclick.name = name;
-                            view.Close();
-                            UIView(vv);
-                        }, "淇敼鍚嶇О", pirclick.deviceId, pirclick.name);
-                    }, () =>
-                    {
-                        NewSwitchView(pirclick, vv);
-                    }, false);
-
-                }
-                else
-                {
-                    string text = Language.StringByID(StringId.shanchushebei) + pirclick.name + "?";
-                    TipPopView tipPopView = new TipPopView();
-                    tipPopView.TipBox(StringId.tip, text, (dialog) =>
-                    {
-                        Thread(dialog, (responsePackNew) =>
-                                {
-                                    var pir = Pir.pirDeviceList.Find((c) => c.deviceId == pirclick.deviceId);
-                                    if (pir != null)
-                                    {
-                                        Pir.pirDeviceList.Remove(pirclick);
-                                    }
-                                    dialog.Close();
-                                    UIView(vv);
-                                }, "鍒犻櫎", pirclick.deviceId, "");
-                    }, () =>
-                    {
-                        NewSwitchView(pirclick, vv);
-                    }, false);
-
-                }
-            });
-        }
-        /// <summary>
-        /// 鍙戦�佺嚎绋�
-        /// </summary>
-        /// <param name="dialog"></param>
-        /// <param name="action"></param>
-        /// <param name="str"></param>
-        /// <param name="deviceId"></param>
-        /// <param name="obj"></param>
-        void Thread(Dialog dialog, Action<HDL_ON.DAL.Server.ResponsePackNew> action, string str, string deviceId, string obj)
-        {
-            //鍔犺浇log
-            Loading loading = new Loading();
-            dialog.AddChidren(loading);
-            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-            loading.Start();
-            new System.Threading.Thread(() =>
-            {
-                try
-                {
-                    if (str == "鍒犻櫎")
-                    {
-                        responsePackNew = PirSend.DeleteDevice(deviceId);
-                    }
-                    else if (str == "淇敼鍚嶇О")
-                    {
-
-                        responsePackNew = PirSend.DeviceRename(deviceId, obj);
-                    }
-                }
-                catch { }
-                finally
-                {
-                    Application.RunOnMainThread(() =>
-                    {
-                        loading.Hide();
-                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                        {
-                            action(responsePackNew);
-                        }
-                        else
-                        {
-                            Method method = new Method();
-                            method.ErrorShow(responsePackNew,"");
-                        }
-
-                    });
-                }
-
-            })
-            { IsBackground = true }.Start();
-        }
-    }
-}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
index b5140c1..87b8d69 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
@@ -10,10 +10,9 @@
         public EditControl()
         {
         }
-
-        public void Show(Entity.Function control, Pir pir, Action<Entity.Function> action)
+        public void Show(Entity.Function control,Action<Entity.Function> action)
         {
-
+            #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             PirDevice.View.TopView topView = new View.TopView();
             topView.topNameBtn.TextID = StringId.pipeiyaokongqi;
@@ -32,7 +31,7 @@
                 BackgroundColor = CSS.CSS_Color.viewMiddle,
             };
             this.AddChidren(viewLayout);
-
+            //閬ユ帶鍣ㄥ悕绉�:
             FrameLayout50 editNameFLayout = new FrameLayout50(); 
             editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":";
             editNameFLayout.btnEditText.Text = control.name;
@@ -40,62 +39,37 @@
             editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28);
             editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png";
             viewLayout.AddChidren(editNameFLayout.FLayoutView());
-
+            //閬ユ帶鍣ㄦ墍灞炲尯鍩�:
             FrameLayout50 areaFLayout = new FrameLayout50(); 
             areaFLayout.btnText.Text = Language.StringByID(StringId.yaokongqiquyu);
             areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
             areaFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom;
             viewLayout.AddChidren(areaFLayout.FLayoutView());
-
+            #endregion
+            #region
+            //淇敼鍚嶇О鐐瑰嚮浜嬩欢
             editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
             {
                 List<string> list = new List<string>();
 
-                for (int i = 0; i < pir.FunctioList.Count; i++)
+                for (int i = 0; i < Pir.currPir.FunctioList.Count; i++)
                 {
-                    list.Add(pir.FunctioList[i].name);
+                    list.Add(Pir.currPir.FunctioList[i].name);
                 }
                 Method method = new Method();
-                method.EditControlName(StringId.editName,list, control.name, (name,view) =>
+                method.EditControlName(StringId.editName,list, control.name, (name, dialog) =>
                 {
-                    //鍔犺浇log
-                    Loading loading = new Loading();
-                    view.AddChidren(loading);
-                    HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-                    loading.Start();
-                    new System.Threading.Thread(() =>
+                    Method.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) =>
                     {
-                        try
-                        {
-                            responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
-                        }
-                        catch { }
-                        finally
-                        {
-                            Application.RunOnMainThread(() =>
-                            {
-                                loading.Hide();
-                                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                                {
-                                    view.Close();
-                                    editNameFLayout.btnEditText.Text = name;
-                                    control.name = name;
-                                }
-                                else
-                                {
-                                    Method methodError = new Method(); 
-                                    methodError.ErrorShow(responsePackNew,"");
-                                }
+                        dialog.Close();
+                        editNameFLayout.btnEditText.Text = name;
+                        control.name = name;
 
-                            });
-                        }
-
-                    })
-                    { IsBackground = true }.Start();
-
+                    }, "淇敼鍚嶇О", "dialog", null, dialog);
                    
                 },()=> { });
             };
+            //閬ユ帶鍣ㄦ墍灞炲尯鍩熼�変腑浜嬩欢
             areaFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
             {
                 Method method = new Method();
@@ -105,6 +79,7 @@
                     areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
                 });
             };
+            #endregion
         }
     }
 }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index e62c484..19bca3c 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -8,6 +8,36 @@
 {
     public class Method
     {
+        /// <summary>
+        /// 绋嬪簭涓诲叆鍙�
+        /// </summary>
+        /// <param name="frame"></param>
+        /// <param name="function"></param>
+        public void MainView(FrameLayout frame, Entity.Function function,Action action)
+        {
+            Pir pirDevice = new Pir();
+            if (function != null)
+            {//鏁版嵁杞崲
+                pirDevice.name = function.name;
+                pirDevice.deviceId = function.deviceId;
+                pirDevice.sid = function.sid;
+                pirDevice.online = function.online;
+            }
+            Pir.currPir = pirDevice;
+            GetControlList(frame, () =>
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    var page = new PirMain();
+                    MainPage.BasePageView.AddChidren(page);
+                    page.Show();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                    page.BackAction += () => {
+                        action?.Invoke();
+                    };
+                });
+            }, Pir.currPir);
+        }
 
         /// <summary>
         /// 绠$悊浣嶇疆
@@ -241,7 +271,7 @@
 
         }
         /// <summary>
-        /// 鑾峰彇閬ユ帶鍣ㄥ垪琛�
+        /// 鑾峰彇鎵�鏈夌孩澶栧疂閬ユ帶鍣ㄥ垪琛�
         /// </summary>
         /// <param name="action">鍥炶皟鍑芥暟</param>
         public static void GetControlList(Action action)
@@ -296,6 +326,64 @@
             { IsBackground = true }.Start();
 
         }
+
+        /// <summary>
+        /// 鑾峰彇鍗曚釜绾㈠瀹濋仴鎺у櫒鍒楄〃
+        /// </summary>
+        /// <param name="action">鍥炶皟鍑芥暟</param>
+        public static void GetControlList(FrameLayout frame ,Action action, Pir pirDevice)
+        {
+            Loading loading = new Loading();
+            frame.AddChidren(loading);
+            loading.Start();
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+
+                    try
+                    {
+                        var responsePackNew = PirSend.ControlList(pirDevice);
+                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                        {
+                            var jArray = 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);
+                                    }
+                                }
+
+                            }
+                        }
+
+                    }
+                    catch { }
+
+
+                }
+                catch { }
+                finally
+                {
+
+                    Application.RunOnMainThread(() =>
+                    {
+                        loading.Hide();
+                        action();
+                    });
+                }
+
+            })
+            { IsBackground = true }.Start();
+
+        }
         /// <summary>
         /// 鑾峰彇璁惧璇︽儏閫氳繃(spk,sid)
         /// </summary>
@@ -334,20 +422,29 @@
             })
             { IsBackground = true }.Start();
         }
-   
+
         /// <summary>
         /// 鍙戦�佸懡浠ょ嚎绋�
         /// </summary>
         /// <param name="control">鍙戦�佹暟鎹璞�</param>
         /// <param name="action">鍥炶皟鍑芥暟</param>
         /// <param name="str">鍒ゆ柇瀛楃</param>
+        /// <param name="view">鍒ゆ柇log鐖舵帶浠�</param>
         /// <param name="frame">log鐖舵帶浠�</param>
-        public void ThreadSend(Control control, Action<ResponsePackNew> action, string str, FrameLayout frame)
+        /// <param name="dialog">log鐖舵帶浠�</param>
+        public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str,string view, FrameLayout frame, Dialog dialog)
         {
            
             //鍔犺浇log
             Loading loading = new Loading();
-            frame.AddChidren(loading);
+            if (view == "dialog")
+            {
+                dialog.AddChidren(loading);
+            }
+            else
+            {
+                frame.AddChidren(loading);
+            }
             loading.Start();
             ResponsePackNew responsePackNew = null;
             new System.Threading.Thread(() =>
@@ -364,64 +461,6 @@
                         responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
                     }
                     else if (str == "鍒犻櫎鎸夐敭") {
-                       // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name);
-                    }
-                }
-                catch { }
-                finally
-                {
-                    Application.RunOnMainThread(() =>
-                    {
-                        loading.Hide();
-                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                        {
-                            action(responsePackNew);
-                        }
-                        else
-                        {
-                            Method method = new Method();
-                            method.ErrorShow(responsePackNew, "");
-                        }
-
-                    });
-                }
-
-            })
-            { IsBackground = true }.Start();
-
-
-        }
-        /// <summary>
-        /// 鍙戦�佸懡浠ょ嚎绋�
-        /// </summary>
-        /// <param name="control">鍙戦�佹暟鎹璞�</param>
-        /// <param name="action">鍥炶皟鍑芥暟</param>
-        /// <param name="str">鍒ゆ柇瀛楃</param>
-        /// <param name="dialog">log鐖舵帶浠�</param>
-        public void ThreadSend(Control control, Action<ResponsePackNew> action, string str,Dialog dialog)
-        {
-            //鍔犺浇log
-            Loading loading = new Loading();
-            dialog.AddChidren(loading);
-            ResponsePackNew responsePackNew = null;
-            loading.Start();
-            new System.Threading.Thread(() =>
-            {
-                try
-                {
-
-
-                    if (str == "鍒犻櫎")
-                    {
-                        responsePackNew = PirSend.DeleteDevice(control.deviceId);
-                    }
-                    else if (str == "淇敼鍚嶇О")
-                    {
-
-                        responsePackNew = PirSend.DeviceRename(control.deviceId, control.name);
-                    }
-                    else if (str == "鍒犻櫎鎸夐敭")
-                    {
                        // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name);
                     }
                 }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
index f4d2996..8f38cfb 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -12,207 +12,288 @@
             Tag = "PirMain";
         }
         /// <summary>
+        /// 鍥炶皟
+        /// </summary>
+        public Action BackAction;
+        /// <summary>
         /// 涓存椂鍌ㄥ瓨璁惧绫诲瀷鍒楄〃
         /// </summary>
         List<DeviceType> DeviceTypeList = new List<DeviceType>();
-        public void Show(Entity.Function function)
+        public void Show()
         {
-            #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             PirDevice.View.TopView topView = new View.TopView();
             topView.topNameBtn.TextID = StringId.hongwaiyaokong;
+            topView.topIconBtn.Visible = true;
             this.AddChidren(topView.FLayoutView());
-            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
+            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => {
+                BackAction();
+                this.RemoveFromParent(); };
+
             FrameLayout middFLayout = new FrameLayout();
             middFLayout.Y = Application.GetRealHeight(64);
             middFLayout.Height = Application.GetRealHeight(667 - 64);
             this.AddChidren(middFLayout);
-            View.MainView mainView = new View.MainView();
-            mainView.Show(middFLayout);
-            FrameLayout deviceListFLayout = new FrameLayout();
-            deviceListFLayout.Y = mainView.pirDeviceFLayout.Bottom + Application.GetRealHeight(12);
-            deviceListFLayout.X = Application.GetRealWidth(16);
-            deviceListFLayout.Width = Application.GetRealWidth(343);
-            deviceListFLayout.Height = Application.GetRealHeight(328);
-            deviceListFLayout.BackgroundColor = CSS.CSS_Color.view;
-            deviceListFLayout.Radius = (uint)Application.GetRealHeight(12);
-            middFLayout.AddChidren(deviceListFLayout);
-            ///娣诲姞閬ユ帶鍣�
-            Button text3Btn = new Button
-            {
-                Y = Application.GetRealHeight(11),
-                X = Application.GetRealWidth(16),
-                Width = Application.GetRealWidth(100),
-                Height = Application.GetRealHeight(20),
-                TextSize = TextSize.text14,
-                TextColor = CSS.CSS_Color.textConfirmColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextID = StringId.tianjiayaokongqi,
-                IsBold = true,
-            };
-            deviceListFLayout.AddChidren(text3Btn);
-            ///绾㈠瀹濆悕绉�
-            Button deviceNameBtn = new Button
-            {
-                Y = Application.GetRealHeight(13),
-                X = Application.GetRealWidth(161),
-                Width = Application.GetRealWidth(150),
-                Height = Application.GetRealHeight(17),
-                TextSize = TextSize.text12,
-                TextColor = CSS.CSS_Color.textColor,
-                TextAlignment = TextAlignment.CenterRight,
-                Text = "mini鏅鸿兘閬ユ帶鍣�",
-            };
-            deviceListFLayout.AddChidren(deviceNameBtn);
 
-            //涓嬫媺鍥炬爣
-            var dropdownIconBtn = new Button
+            VerticalRefreshLayout vv = new VerticalRefreshLayout();
+            middFLayout.AddChidren(vv);
+            //鍔犲彿鍥炬爣
+            Button addDevice = new Button
             {
-                Y = Application.GetRealHeight(13),
-                X = Application.GetRealWidth(343 - 8 - 16),
-                Width = Application.GetRealWidth(16),
-                Height = Application.GetRealWidth(16),
-                UnSelectedImagePath = "PirIcon/dropdown.png",
+                Y = Application.GetRealHeight(480),
+                X = Application.GetRealWidth(293),
+                Width = Application.GetRealWidth(82),
+                Height = Application.GetRealWidth(84),
+                UnSelectedImagePath = "PirIcon/add.png",
             };
-            deviceListFLayout.AddChidren(dropdownIconBtn);
-            #endregion
 
-            if (Pir.pirDeviceList.Count != 0)
+            if (Pir.currPir.FunctioList.Count < 10)
             {
-
-                //if (function != null)
-                //{
-                //    Pir pir = new Pir();
-                //    pir.name = function.name;
-                //    pir.deviceId = function.deviceId;
-                //    pir.sid = function.sid;
-                //    Pir.currPir = pir;
-                //}
-                //else
-                //{
-                //    Pir.currPir = Pir.pirDeviceList[0];
-                //}
-                //榛樿绗竴涓孩澶栧疂
-                Pir.currPir = Pir.pirDeviceList[0];
-                int sum = 0;
-                Pir.currPir = Pir.pirDeviceList[0];
-                for (int i = 0; i < Pir.pirDeviceList.Count; i++)
-                {
-                    //鏌ユ壘
-                    sum += Pir.pirDeviceList[i].FunctioList.Count;
-                }
-                deviceNameBtn.Text = Pir.pirDeviceList[0].name;
-                mainView.numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge);
-                mainView.currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge);
+                //10涓仴鎺у櫒灏变細闅愯棌娣诲姞鍥炬爣
+                middFLayout.AddChidren(addDevice);
             }
 
-            ///璁惧绠$悊鐨勭偣鍑讳簨浠�
-            mainView.clickBtn.MouseUpEventHandler += (sender, e) =>
+            vv.BeginHeaderRefreshingAction += () =>
+                {
+                    ////鍏抽棴鍒锋柊View锛�
+                    vv.EndHeaderRefreshing();
+
+                    Method.GetControlList(this, () =>
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            //鍒锋柊鐣岄潰
+                            UIView(vv);
+                        });
+                    }, Pir.currPir);
+
+                };
+            UIView(vv);
+
+            topView.clickSetBtn.MouseUpEventHandler += (sender, e) =>
             {
 
-                DeviceSet deviceSet = new DeviceSet();
-                MainPage.BasePageView.AddChidren(deviceSet);
-                deviceSet.Show(() =>
+                SetPir setPir = new SetPir();
+                MainPage.BasePageView.AddChidren(setPir);
+                setPir.Show(() =>
                 {
-                    if (Pir.currPir != null)
-                    {
-                        deviceNameBtn.Text = Pir.currPir.name;
-                        mainView.numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge);
-                    }
-                    int sum = 0;
-                    for (int i = 0; i < Pir.pirDeviceList.Count; i++)
-                    {
-                        sum += Pir.pirDeviceList[i].FunctioList.Count;
-                    }
-                    mainView.currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge);
-
-
+                    BackAction();
+                    ////鍒锋柊鐣岄潰
+                    UIView(vv);
                 });
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             };
-            ///绾㈠鍚嶇О鐨勭偣鍑讳簨浠�
-            deviceNameBtn.MouseUpEventHandler += (sender, e) =>
+            addDevice.MouseUpEventHandler += (sender, e) =>
             {
-                View.HeigthChangeView heigthChangeView = new View.HeigthChangeView();
-                heigthChangeView.Show(this, Pir.pirDeviceList, (pirJson) =>
+                FrameLayout frame = new FrameLayout
                 {
-                    deviceNameBtn.Text = pirJson.name;
-                    Pir.currPir = pirJson;
-                });
-            };
-
-            int line = 0;
-            for (int i = 1, j = 0; i <= 7; i++, j++)
-            {
-                var currpirdeviceFLayout = new FrameLayout
-                {
-                    Width = Application.GetRealWidth(80),
-                    Height = Application.GetRealWidth(80),
-                    X = Application.GetRealWidth(26 + (80 + 25) * j),
-                    Y = Application.GetRealHeight(52 + (80 + 12) * line),
-
+                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
                 };
-                deviceListFLayout.AddChidren(currpirdeviceFLayout);
-                var deviceIconBtn = new Button
+                this.AddChidren(frame);
+                FrameLayout controlFl = new FrameLayout();
+                controlFl.Y = Application.GetRealHeight(319);
+                controlFl.X = Application.GetRealWidth(16);
+                controlFl.Width = Application.GetRealWidth(343);
+                controlFl.Height = Application.GetRealHeight(328);
+                controlFl.BackgroundColor = CSS.CSS_Color.view;
+                controlFl.Radius = (uint)Application.GetRealHeight(12);
+                frame.AddChidren(controlFl);
+                ///娣诲姞閬ユ帶鍣�
+                Button text3Btn = new Button
                 {
-                    Y = Application.GetRealHeight(8),
-                    X = Application.GetRealWidth(20),
-                    Width = Application.GetRealWidth(40),
-                    Height = Application.GetRealWidth(40),
-                    UnSelectedImagePath = "PirIcon/Infraredtreasure.png",
-                };
-                currpirdeviceFLayout.AddChidren(deviceIconBtn);
-                var iconNameBtn = new Button
-                {
-                    Y = deviceIconBtn.Bottom + Application.GetRealHeight(8),
-                    Width = Application.GetRealWidth(80),
-                    Height = Application.GetRealHeight(17),
-                    TextSize = TextSize.text12,
-                    TextColor = CSS.CSS_Color.TextualColor,
+                    Y = Application.GetRealHeight(12),
+                    X = Application.GetRealWidth(16),
+                    Width = Application.GetRealWidth(343 - 16 * 2),
+                    Height = Application.GetRealHeight(20),
+                    TextSize = TextSize.text14,
+                    TextColor = CSS.CSS_Color.textConfirmColor,
                     TextAlignment = TextAlignment.Center,
+                    TextID = StringId.tianjiayaokongqi,
+                    IsBold = true,
                 };
-                currpirdeviceFLayout.AddChidren(iconNameBtn);
-                var clickBtn = new Button { Tag = i };
-                currpirdeviceFLayout.AddChidren(clickBtn);
-                if (i % 3 == 0)
-                {
-                    //婊′竴琛岄噸缃甹=0鍊�;
-                    j = -1;
-                    line += 1;
-                }
-                GetIconAndText(i, deviceIconBtn, iconNameBtn);
-                clickBtn.MouseUpEventHandler += (sender, e) =>
+                controlFl.AddChidren(text3Btn);
+                frame.MouseUpEventHandler += (sender1, e1) =>
                 {
 
-                    //1=绌鸿皟;2=鐢佃;3=椋庢墖;4=鏈洪《鐩�;5=DVD/EVD/VCD;6=鎶曞奖浠�;7=鑷畾涔�;
-                    int if_value = int.Parse(clickBtn.Tag.ToString());
-                    if (if_value == 7)
+                    frame.RemoveFromParent();
+                };
+                int line = 0;
+                for (int i = 1, j = 0; i <= 7; i++, j++)
+                {
+                    var currpirdeviceFLayout = new FrameLayout
                     {
-                        Method method = new Method();
-                        method.AddControl(this, (control) =>
-                        {
-                            AddButton addButton = new AddButton();
-                            MainPage.BasePageView.AddChidren(addButton);
-                            addButton.Show(control);
-                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                        });
+                        Width = Application.GetRealWidth(80),
+                        Height = Application.GetRealWidth(80),
+                        X = Application.GetRealWidth(26 + (80 + 25) * j),
+                        Y = Application.GetRealHeight(52 + (80 + 12) * line),
+
+                    };
+                    controlFl.AddChidren(currpirdeviceFLayout);
+                    var deviceIconBtn = new Button
+                    {
+                        Y = Application.GetRealHeight(8),
+                        X = Application.GetRealWidth(20),
+                        Width = Application.GetRealWidth(40),
+                        Height = Application.GetRealWidth(40),
+                        UnSelectedImagePath = "PirIcon/Infraredtreasure.png",
+                    };
+                    currpirdeviceFLayout.AddChidren(deviceIconBtn);
+                    var iconNameBtn = new Button
+                    {
+                        Y = deviceIconBtn.Bottom + Application.GetRealHeight(8),
+                        Width = Application.GetRealWidth(80),
+                        Height = Application.GetRealHeight(17),
+                        TextSize = TextSize.text12,
+                        TextColor = CSS.CSS_Color.TextualColor,
+                        TextAlignment = TextAlignment.Center,
+                    };
+                    currpirdeviceFLayout.AddChidren(iconNameBtn);
+                    var clickBtn = new Button { Tag = i };
+                    currpirdeviceFLayout.AddChidren(clickBtn);
+                    if (i % 3 == 0)
+                    {
+                        //婊′竴琛岄噸缃甹=0鍊�;
+                        j = -1;
+                        line += 1;
                     }
-                    else
+                    GetIconAndText(i, deviceIconBtn, iconNameBtn);
+                    clickBtn.MouseUpEventHandler += (sender2, e2) =>
                     {
-                        if (DeviceTypeList.Count == 0)
+                       
+                        //1=绌鸿皟;2=鐢佃;3=椋庢墖;4=鏈洪《鐩�;5=DVD/EVD/VCD;6=鎶曞奖浠�;7=鑷畾涔�;
+                        int if_value = int.Parse(clickBtn.Tag.ToString());
+                        if (if_value == 7)
                         {
-                            GetDeviceTypeList(true, () =>
-                             {
-                                 DeviceTypeViewClick(if_value);
-
-                             });
+                            Method method = new Method();
+                            method.AddControl(this, (control) =>
+                            {
+                                //鎴愬姛鍚庣Щ闄�;
+                                frame.RemoveFromParent();
+                                AddButton addButton = new AddButton();
+                                MainPage.BasePageView.AddChidren(addButton);
+                                addButton.Show(control);
+                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                            });
                         }
                         else
                         {
-                            DeviceTypeViewClick(if_value);
+                            //杩涙潵閮借绉婚櫎;
+                            frame.RemoveFromParent();
+                            if (DeviceTypeList.Count == 0)
+                            {
+                                GetDeviceTypeList(true, () =>
+                                 {
+                                     DeviceTypeViewClick(if_value);
+
+                                 });
+                            }
+                            else
+                            {
+                                DeviceTypeViewClick(if_value);
+                            }
                         }
-                    }
+                    };
+                }
+
+            };
+
+        }
+        /// <summary>
+        /// 鍔犺浇UI鐣岄潰
+        /// </summary>
+        /// <param name="vv">涓婁笅婊戞帶浠�</param>
+        private void UIView(VerticalRefreshLayout vv)
+        {
+            vv.RemoveAll();
+            #region 绾㈠瀹濆浘鏍� 鐗堟湰鍙� 鍚嶇О 鐘舵��
+            FrameLayout fLayout = new FrameLayout
+            {
+                Width = Application.GetRealWidth(375),
+                Height = Application.GetRealHeight(12 + 92 + (50 * Pir.currPir.FunctioList.Count)),
+            };
+            vv.AddChidren(fLayout);
+            View.PirView pirView = new View.PirView();
+            //绾㈠瀹濆悕绉�
+            pirView.deviceNameBtn.Text = Pir.currPir.name;
+            //绾㈠瀹濆綋鍓嶆湁澶氬皯涓仴鎺у櫒
+            pirView.geBtn.Text = Pir.currPir.FunctioList.Count.ToString();
+            //绾㈠瀹濇槸鍚﹀湪绾�-绂荤嚎
+            if (Pir.currPir.online)
+            {
+                pirView.stateIconBtn.IsSelected = true;
+                pirView.stateTextBtn.IsSelected = true;
+                pirView.stateTextBtn.TextID = StringId.zaixian;
+            }
+            else
+            {
+                pirView.stateIconBtn.IsSelected = false;
+                pirView.stateTextBtn.IsSelected = false;
+                pirView.stateTextBtn.TextID = StringId.lixian;
+            }
+            //鏍囪绾㈠瀹�
+            pirView.clickBtn.Tag = Pir.currPir;
+            //鍔犺浇鐣岄潰
+            pirView.Show(Pir.currPir.FunctioList.Count, fLayout);
+            //鏈�鍚庝竴涓悗闈㈠鍔犻棿闅旇儗鏅�
+            vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) });
+            #endregion
+
+            for (int j = 0; j < Pir.currPir.FunctioList.Count; j++)
+            {
+                var control = Pir.currPir.FunctioList[j];
+
+                View.ControlView controlView = new View.ControlView();
+                controlView.Show(pirView.devfLayout, j);
+                //閬ユ帶鍣ㄥ悕绉�
+                controlView.nameBtn.Text = control.name;
+                //閬ユ帶鍣ㄥ瓨鏀惧尯鍩�
+                controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
+                //鏍囪閬ユ帶鍣�
+                controlView.delBtn.Tag = control;
+                //鍒犻櫎鐐瑰嚮浜嬩欢
+                controlView.delBtn.MouseUpEventHandler += (sender, e) =>
+                {
+                    var Function = controlView.delBtn.Tag as Entity.Function;
+                    string text = Language.StringByID(StringId.shanchushebei) + Function.name + "?";
+                    TipPopView tipPopView = new TipPopView();
+                    tipPopView.TipBox(StringId.tip, text, (dialog) =>
+                    {
+                        Method.ThreadSend(new Control { deviceId=control.deviceId}, (responsePackNew) =>
+                        {
+                            dialog.Close();
+                            var function = Pir.currPir.FunctioList.Find((c) => c.sid == Function.sid);
+                            if (function != null)
+                            {
+                                Pir.currPir.FunctioList.Remove(Function);
+                            }
+                            UIView(vv);
+
+                        }, "鍒犻櫎", "dialog", null, dialog);
+
+                    }, () => { }, false);
                 };
+                //view鐐瑰嚮浜嬩欢
+                controlView.clickBtn.MouseUpEventHandler += (sender, e) =>
+                {
+                    EditControl editControl = new EditControl();
+                    MainPage.BasePageView.AddChidren(editControl);
+                    editControl.Show(control,(device) =>
+                    {
+                        //鍥炶皟鏇存柊鍚嶅瓧/鍖哄煙
+                        controlView.nameBtn.Text = device.name;
+                        controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(device);
+
+                    });
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                };
+                if (j == Pir.currPir.FunctioList.Count - 1)
+                {
+                    //鏈�鍚庢敼鍙樹竴涓嚎鐨勯鑹�
+                    controlView.line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence;
+                    controlView.funControlRow.LineColor = CSS.CSS_Color.viewTranslucence;
+                }
+
+
             }
         }
         /// <summary>
@@ -238,7 +319,6 @@
             });
 
         }
-
         /// <summary>
         /// 鑾峰彇璁惧绫诲瀷str
         /// </summary>
@@ -424,6 +504,8 @@
                 }
             }, id, "鍝佺墝鍒楄〃");
         }
+
+
     }
 
 }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
index af9c380..8099160 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -152,13 +152,6 @@
         /// <returns></returns>
         public static void CodeStudy(Control control,AttributesStatus buttonObj,Action<ResponsePackNew> action)
         {
-            //var whichDayJson = jay["whichDay"].ToString();
-            //var whichDayAry = Newtonsoft.Json.Linq.JArray.Parse(whichDayJson);
-            //for (int b = 0; b < whichDayAry.Count; b++)
-            //{
-            //    var days = whichDayAry[b].ToString();
-            //    timer.whichDay.Add(int.Parse(days));
-            //}
             var job = new JObject { };
             job.Add("key", buttonObj.key);
             job.Add("data_type", "string");
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
new file mode 100644
index 0000000..95a465b
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
@@ -0,0 +1,134 @@
+锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
+using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View;
+using Shared;
+namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
+{
+
+    public class SetPir : FrameLayout
+    {
+        public SetPir()
+        {
+            Tag = "PirMain";
+        }
+
+        public void Show(Action action)
+        {
+            #region 鐣岄潰甯冨眬
+            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
+            Intelligence.Automation.LogicView.TopView topView = new Intelligence.Automation.LogicView.TopView();
+            this.AddChidren(topView.FLayoutView());
+            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
+            {
+                action();
+                RemoveFromParent();
+            };
+            topView.topNameBtn.TextID = StringId.setlogic;
+            FrameLayout viewLayout = new FrameLayout
+            {
+                Y = Application.GetRealHeight(64),
+                Width = Application.GetRealWidth(Intelligence.Automation.LogicView.TextSize.view375),
+                Height = Application.GetRealHeight(Intelligence.Automation.LogicView.TextSize.view667 - 64 - 76),
+                BackgroundColor = CSS.CSS_Color.viewMiddle,
+            };
+            this.AddChidren(viewLayout);
+            ///鍚嶇О
+            FrameLayout50 editNameFLayout = new FrameLayout50();
+            editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":";
+            editNameFLayout.btnEditText.Text = Pir.currPir.name;
+            editNameFLayout.btnNextIcon.Height = Application.GetRealWidth(28);
+            editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28);
+            editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png";
+            viewLayout.AddChidren(editNameFLayout.FLayoutView());
+            ///鐗堟湰鍗囩骇
+            FrameLayout50 banbenshengjiFL = new FrameLayout50();
+            banbenshengjiFL.btnText.Text = Language.StringByID(StringId.banbenshengji);
+            banbenshengjiFL.frameLayout.Y = editNameFLayout.frameLayout.Bottom;
+            viewLayout.AddChidren(banbenshengjiFL.FLayoutView());
+            ///鐗堟湰鍙�:v1.3.5
+            FrameLayout50 banbenhaoFLayout = new FrameLayout50();
+            banbenhaoFLayout.btnNextIcon.Visible = false;
+            banbenhaoFLayout.btnText.Text = Language.StringByID(StringId.banbenhao) + ":v1.3.5";
+            banbenhaoFLayout.frameLayout.Y = banbenshengjiFL.frameLayout.Bottom;
+            viewLayout.AddChidren(banbenhaoFLayout.FLayoutView());
+            //鍒犻櫎
+            FrameLayout frameLayout = new FrameLayout
+            {
+                Y = Application.GetRealHeight(Intelligence.Automation.LogicView.TextSize.view667 - 50),
+                Height = Application.GetRealHeight(50),
+                BackgroundColor = CSS.CSS_Color.view,
+                Gravity = Gravity.BottomCenter,//缃簳鐨勫睘鎬�
+            };
+            this.AddChidren(frameLayout);
+            Button btnDel = new Button
+            {
+                TextSize = Intelligence.Automation.LogicView.TextSize.text16,
+                Width = Application.GetRealWidth(50),
+                Height = Application.GetRealHeight(22),
+                TextColor = CSS.CSS_Color.textRedColor,
+                Gravity = Gravity.Center,
+                TextID = StringId.Del,
+            };
+            frameLayout.AddChidren(btnDel);
+            #endregion
+            #region  鐣岄潰鐐瑰嚮浜嬩欢
+            //淇敼鍚嶇О鐨勭偣鍑讳簨浠�
+            editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) =>
+            {
+                List<string> list = new List<string>();
+                Method method = new Method();
+                method.EditControlName(StringId.editName, list, Pir.currPir.name, (name, dialog) =>
+                {
+                    Method.ThreadSend(new Control { deviceId = Pir.currPir.deviceId, name = name }, (responsePackNew) =>
+                    {
+                        dialog.Close();
+                        editNameFLayout.btnEditText.Text = name;
+                        Pir.currPir.name = name;
+
+                    }, "淇敼鍚嶇О", "dialog", null, dialog);
+
+                }, () => { });
+            };
+            //鍒犻櫎绾㈠瀹濈殑鐐瑰嚮浜嬩欢
+            EventHandler<MouseEventArgs> delClick = (sender, e) =>
+            {
+                string text = Language.StringByID(StringId.shanchushebei) + Pir.currPir.name + "?";
+                TipPopView tipPopView = new TipPopView();
+                tipPopView.TipBox(StringId.tip, text, (dialog) =>
+                {
+
+                    Method.ThreadSend(new Control { deviceId = Pir.currPir.deviceId }, (responsePackNew) =>
+                    {
+                        var pir = Pir.pirDeviceList.Find((c) => c.deviceId == Pir.currPir.deviceId);
+                        if (pir != null)
+                        {
+                            Pir.pirDeviceList.Remove(Pir.currPir);
+                        }
+                        dialog.Close();
+                        action();
+                        this.RemoveFromParent();
+                        for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
+                        {
+                            var view = MainPage.BasePageView.GetChildren(i);
+                            if (view.GetType() == typeof(PirMain))
+                            {
+                                view.RemoveFromParent();
+                            }
+                        }
+                    }, "鍒犻櫎", "dialog", null, dialog);
+
+                }, () =>
+                {
+                }, false);
+
+
+            };
+            btnDel.MouseUpEventHandler += delClick;
+            frameLayout.MouseUpEventHandler += delClick;
+            #endregion
+
+        }
+
+    }
+}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs
index eacada3..b11ecb4 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs
@@ -20,7 +20,7 @@
         public Button btnText = new Button
         {
             TextSize = TextSize.Text16,
-            Width = Application.GetRealWidth(200),
+            Width = Application.GetRealWidth(150),
             Height = Application.GetRealHeight(22),
             TextColor = CSS.CSS_Color.textColor,
             X = Application.GetRealWidth(16),
@@ -31,11 +31,11 @@
         /// </summary>
         public Button btnEditText = new Button
         {
-            Width = Application.GetRealWidth(357 - 52 - 200 - 16),
+            Width = Application.GetRealWidth(357 - 52 - 150 - 16),
             Height = Application.GetRealHeight(20),
             TextSize = TextSize.Text14,
             TextColor = CSS.CSS_Color.textCancelColor,
-            X = Application.GetRealWidth(200 + 16),
+            X = Application.GetRealWidth(150 + 16),
             TextAlignment = TextAlignment.CenterRight,
         };
 
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TopView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TopView.cs
index 65015f8..130709b 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TopView.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TopView.cs
@@ -48,7 +48,7 @@
             X = Application.GetRealWidth(337),
             Width = Application.GetRealWidth(28),
             Height = Application.GetRealWidth(28),
-            UnSelectedImagePath = "PirIcon/adddevice.png",
+            UnSelectedImagePath = "LogicIcon/set.png",
             Visible = false,
         };
         /// <summary>

--
Gitblit v1.8.0