From bd2c6c39668f2495d14440ae2d6bb7a7856e9d2f Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 12 三月 2021 17:47:57 +0800
Subject: [PATCH] 2021-3-12-3

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs |  113 ++++++++
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs        |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs     |  174 +++++++++++++
 .vs/HDL_APP_Project/xs/UserPrefs.xml                         |   14 
 HDL_ON/HDL_ON.projitems                                      |    2 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs        |  455 +++++++++-------------------------
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs           |   16 +
 7 files changed, 435 insertions(+), 341 deletions(-)

diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index 1fc21ed..10f9f7d 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,13 +1,13 @@
 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
   <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-001674E61438002E" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs">
     <Files>
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="290" Column="15" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="389" Column="22" />
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="250" Column="36" />
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="378" Column="17" />
       <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="293" Column="55" />
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" Line="154" Column="72" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="138" Column="45" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="132" Column="75" />
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" Line="267" Column="70" />
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs" Line="14" Column="91" />
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs" Line="59" Column="65" />
@@ -15,6 +15,9 @@
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs" Line="214" Column="1" />
       <File FileName="HDL_ON/Entity/Function/Function.cs" Line="637" Column="18" />
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" Line="220" Column="55" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs" Line="167" Column="20" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" Line="232" Column="70" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs" Line="104" Column="45" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
@@ -25,7 +28,8 @@
                 <Node name="UI2" expanded="True">
                   <Node name="4-PersonalCenter" expanded="True">
                     <Node name="PirDevice" expanded="True">
-                      <Node name="PirMain.cs" selected="True" />
+                      <Node name="View" expanded="True" />
+                      <Node name="DeviceSet.cs" selected="True" />
                     </Node>
                   </Node>
                 </Node>
@@ -44,7 +48,7 @@
     <String>Shared.IOS/Shared.IOS.csproj</String>
   </DisabledProjects>
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
-  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.Android_Accelerated_Oreo" />
+  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.4b65c4650918" />
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
     <BreakpointStore />
   </MonoDevelop.Ide.DebuggingService.Breakpoints>
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index e3e94a0..d2037b3 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -361,6 +361,8 @@
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\PirNameView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\EditControl.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\FrameLayout50.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\PirView.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\ControlView.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="$(MSBuildThisFileDirectory)UI\" />
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
index cc5c709..559e88a 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -134,7 +134,7 @@
                     if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                     {
                         Method method = new Method();
-                        var mqttdate = method.MqttDate(control.sid, 20);
+                        var mqttdate = method.MqttDate(control.sid, 25);
                         if (mqttdate !=null)
                         {
                             //浼戠湢鏄负鏄剧ず寮曞鐣岄潰
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
index 33aee38..d936aef 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
@@ -37,8 +37,8 @@
                  {
                      Application.RunOnMainThread(() =>
                      {
-                        //鍒锋柊鐣岄潰
-                        UIView(vv);
+                         //鍒锋柊鐣岄潰
+                         UIView(vv);
                      });
                  });
 
@@ -64,150 +64,32 @@
                     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 * pirDevice.FunctioList.Count)),
-                    BackgroundColor = CSS.CSS_Color.view,
-                    Radius = (uint)Application.GetRealHeight(12),
-                };
-                fLayout.AddChidren(devfLayout);
-
-
-                //绾㈠瀹濆浘鏍�
-                Button priequipmentBtn = new Button
-                {
-                    Y = Application.GetRealHeight(16),
-                    X = Application.GetRealWidth(5),
-                    Width = Application.GetRealWidth(60),
-                    Height = Application.GetRealWidth(60),
-                    UnSelectedImagePath = "PirIcon/priequipment.png",
-                    TextAlignment = TextAlignment.Center,
-                };
-                devfLayout.AddChidren(priequipmentBtn);
+                View.PirView pirView = new View.PirView();
                 //绾㈠瀹濆悕绉�
-                Button deviceNameBtn = new Button
-                {
-                    Y = Application.GetRealHeight(16),
-                    X = priequipmentBtn.Right + Application.GetRealWidth(7),
-                    Width = Application.GetRealWidth(120),
-                    Height = Application.GetRealHeight(20),
-                    Text = pirDevice.name,
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextSize = TextSize.text14,
-                    TextColor = CSS.CSS_Color.textColor,
-                    IsBold = true,
-                };
-                devfLayout.AddChidren(deviceNameBtn);
-                //鐗堟湰鍙�
-                Button versionBtn = new Button
-                {
-                    Y = deviceNameBtn.Bottom + Application.GetRealHeight(4),
-                    X = priequipmentBtn.Right + Application.GetRealWidth(7),
-                    Width = Application.GetRealWidth(120),
-                    Height = Application.GetRealHeight(17),
-                    Text = "鐗堟湰鍙穠1.3.5",
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextSize = TextSize.text12,
-                    TextColor = CSS.CSS_Color.textCancelColor,
-                };
-                devfLayout.AddChidren(versionBtn);
-                // 5/10
-                Button geBtn = new Button
-                {
-                    Y = versionBtn.Bottom + Application.GetRealHeight(2),
-                    X = priequipmentBtn.Right + Application.GetRealWidth(7),
-                    Width = Application.GetRealWidth(120),
-                    Height = Application.GetRealHeight(17),
-                    Text = pirDevice.FunctioList.Count.ToString(),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextSize = TextSize.text12,
-                    TextColor = CSS.CSS_Color.textConfirmColor,
-                };
-                devfLayout.AddChidren(geBtn);
-                geBtn.Width = geBtn.GetTextWidth();
-                // 5/10
-                Button sumBtn = new Button
-                {
-                    Y = versionBtn.Bottom + Application.GetRealHeight(2),
-                    X = geBtn.Right,
-                    Width = Application.GetRealWidth(20),
-                    Height = Application.GetRealHeight(17),
-                    Text = "/10",
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextSize = TextSize.text12,
-                    TextColor = CSS.CSS_Color.textCancelColor,
-                };
-                devfLayout.AddChidren(sumBtn);
-                //鐘舵�佸浘鏍�
-                Button stateIconBtn = new Button
-                {
-                    Y = Application.GetRealHeight(23),
-                    X = Application.GetRealWidth(291),
-                    Width = Application.GetRealWidth(8),
-                    Height = Application.GetRealWidth(8),
-                    UnSelectedImagePath = "PirIcon/online.png",
-                    SelectedImagePath = "PirIcon/offline.png",
-                };
-                devfLayout.AddChidren(stateIconBtn);
-                //绾㈠瀹濈姸鎬侊紙鍦ㄧ嚎-绂荤嚎锛�
-                Button stateTextBtn = new Button
-                {
-                    Y = Application.GetRealHeight(18),
-                    X = Application.GetRealWidth(303),
-                    Width = Application.GetRealWidth(30),
-                    Height = Application.GetRealHeight(17),
-                    TextID = StringId.zaixianhwb,
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextSize = TextSize.text12,
-                    TextColor = 0xFF67D569,// CSS.CSS_Color.textColor,
-                    SelectedTextColor = CSS.CSS_Color.textRedColor,
-                    IsBold = true,
-                };
-                devfLayout.AddChidren(stateTextBtn);
+                pirView.deviceNameBtn.Text = pirDevice.name;
+                //绾㈠瀹濆綋鍓嶆湁澶氬皯涓仴鎺у櫒
+                pirView.geBtn.Text = pirDevice.FunctioList.Count.ToString();
+                //绾㈠瀹濇槸鍚﹀湪绾�-绂荤嚎
                 if (pirDevice.online)
                 {
-                    stateIconBtn.IsSelected = true;
-                    stateTextBtn.IsSelected = true;
+                    pirView.stateIconBtn.IsSelected = true;
+                    pirView.stateTextBtn.IsSelected = true;
                 }
                 else
                 {
-                    stateIconBtn.IsSelected = false;
-                    stateTextBtn.IsSelected = false;
+                    pirView.stateIconBtn.IsSelected = false;
+                    pirView.stateTextBtn.IsSelected = false;
                 }
-                //绾�
-                Button lineBtn = new Button
+                //鏍囪绾㈠瀹�
+                pirView.clickBtn.Tag = pirDevice;
+                //绾㈠瀹濈偣鍑讳簨浠�
+                pirView.clickBtn.MouseUpEventHandler += (sender, e) =>
                 {
-                    Y = Application.GetRealHeight(92) - 1,
-                    X = Application.GetRealWidth(16),
-                    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);
-
-                clickFram.MouseUpEventHandler += (sender, e) =>
-                {
-                    var pirclick = (clickFram.Tag as Pir);
+                    var pirclick = (pirView.clickBtn.Tag as Pir);
                     NewSwitchView(pirclick, vv);
                 };
-
+                //鍔犺浇鐣岄潰
+                pirView.Show(pirDevice.FunctioList.Count, fLayout);
                 if (Pir.pirDeviceList.Count - 1 == i)
                 {
                     //鏈�鍚庝竴涓悗闈㈠鍔犻棿闅旇儗鏅�
@@ -218,153 +100,63 @@
                 for (int j = 0; j < pirDevice.FunctioList.Count; j++)
                 {
                     var control = pirDevice.FunctioList[j];
-                    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),
-                    };
-                    devfLayout.AddChidren(funControlRow);
+
+                    View.ControlView controlView = new View.ControlView();
+                    controlView.Show(pirView.devfLayout, j);
                     //閬ユ帶鍣ㄥ悕绉�
-                    Button nameBtn = new Button
+                    controlView.nameBtn.Text = control.name;
+                    //閬ユ帶鍣ㄥ瓨鏀惧尯鍩�
+                    controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control);
+                    //鏍囪閬ユ帶鍣�
+                    controlView.delBtn.Tag = control;
+                    //鍒犻櫎鐐瑰嚮浜嬩欢
+                    controlView.delBtn.MouseUpEventHandler += (sender, e) =>
                     {
-                        X = Application.GetRealWidth(16),
-                        Width = Application.GetRealWidth(150),
-                        Height = Application.GetRealHeight(20),
-                        Text = control.name,
-                        TextAlignment = TextAlignment.CenterLeft,
-                        TextSize = TextSize.text14,
-                        TextColor = CSS.CSS_Color.textColor,
-                        Gravity = Gravity.CenterVertical,
-                    };
-                    funControlRow.AddChidren(nameBtn);
-                    //閬ユ帶鍣ㄥ尯鍩�
-                    Button areaBtn = new Button
-                    {
-                        X = Application.GetRealWidth(311 + 16 - (40 + 100)),
-                        Width = Application.GetRealWidth(100),
-                        Height = Application.GetRealHeight(17),
-                        Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control),
-                        TextAlignment = TextAlignment.CenterRight,
-                        TextSize = TextSize.text12,
-                        TextColor = CSS.CSS_Color.textCancelColor,
-                        Gravity = Gravity.CenterVertical,
-                    };
-                    funControlRow.AddChidren(areaBtn);
-                    //涓嬩竴绾у浘鏍�
-                    Button nextIconBtn = new Button
-                    {
-                        X = Application.GetRealWidth(295 + 16),
-                        Width = Application.GetRealWidth(16),
-                        Height = Application.GetRealWidth(16),
-                        UnSelectedImagePath = "PirIcon/next.png",
-                        Gravity = Gravity.CenterVertical,
-                    };
-                    funControlRow.AddChidren(nextIconBtn);
-                    //鍒犻櫎
-                    Button delBtn = new Button
-                    {
-                        Width = Application.GetRealWidth(50),
-                        Height = Application.GetRealHeight(22),
-                        TextID = StringId.Del,
-                        TextAlignment = TextAlignment.Center,
-                        TextSize = TextSize.text16,
-                        TextColor = CSS.CSS_Color.textWhiteColor,
-                        IsBold = true,
-                        BackgroundColor = CSS.CSS_Color.textRedColor,
-                        Tag = control,
-                    };
-                    funControlRow.AddRightView(delBtn);
-                    //绾�
-                    Button line1Btn = new Button
-                    {
-                        Y = Application.GetRealHeight(50 - 2),
-                        X = Application.GetRealWidth(16),
-                        Width = Application.GetRealWidth(311),
-                        Height = 1,
-                        BackgroundColor = CSS.CSS_Color.viewLine,
-                    };
-                    funControlRow.AddChidren(line1Btn);
-                    if (j == pirDevice.FunctioList.Count - 1)
-                    {
-                        //鏈�鍚庢敼鍙樹竴涓嚎鐨勯鑹�
-                        line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence;
-                        funControlRow.LineColor = CSS.CSS_Color.viewTranslucence;
-                    }
-                    delBtn.MouseUpEventHandler += (sender, e) =>
-                    {
-                        var Function = delBtn.Tag as Entity.Function;
+                        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) =>
                         {
-                            //鍔犺浇log
-                            Loading loading = new Loading();
-                            dialog.AddChidren(loading);
-                            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-                            loading.Start();
-                            new System.Threading.Thread(() =>
+                            Thread(dialog, (responsePackNew) =>
                             {
-                                try
+                                dialog.Close();
+                                var function = pirDevice.FunctioList.Find((c) => c.sid == Function.sid);
+                                if (function != null)
                                 {
-                                    responsePackNew = PirSend.DeleteDevice(Function.deviceId);
-                                }
-                                catch { }
-                                finally
-                                {
-                                    Application.RunOnMainThread(() =>
+                                    pirDevice.FunctioList.Remove(Function);
+                                    if (Pir.currPir != null && pirDevice.sid == Pir.currPir.sid)
                                     {
-                                        loading.Hide();
-                                        try
-                                        {
-                                            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                                            {
-                                                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);
-                                            }
-                                            else
-                                            {
-                                                Method method = new Method();
-                                                method.ErrorShow(responsePackNew);
-                                            }
-                                        }
-                                        catch { }
-
-                                    });
+                                        Pir.currPir.FunctioList = pirDevice.FunctioList;
+                                    }
                                 }
+                                UIView(vv);
 
-                            })
-                            { IsBackground = true }.Start();
+                            }, "鍒犻櫎", Function.deviceId, "");
+
                         }, () => { }, false);
                     };
-                    EventHandler<MouseEventArgs> editClick = (sender, e) =>
-                    {
-                        EditControl editControl = new EditControl();
-                        MainPage.BasePageView.AddChidren(editControl);
-                        editControl.Show(control, pirDevice, (device) =>
-                        {
-                            //鍥炶皟鏇存柊鍚嶅瓧/鍖哄煙
-                            nameBtn.Text = device.name;
-                            areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(device);
+                    //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;
-                    };
-                    funControlRow.MouseUpEventHandler += editClick;
-                    nameBtn.MouseUpEventHandler += editClick;
-                    areaBtn.MouseUpEventHandler += editClick;
-                    nextIconBtn.MouseUpEventHandler += editClick;
+                         });
+                         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;
+                    }
+
+
                 }
 
             }
@@ -392,40 +184,12 @@
                     Method methodView = new Method();
                     methodView.EditControlName(StringId.xiugaimingzi, list, pirclick.name, (name, view) =>
                     {
-                        pirclick.name = name;
-                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-                        //鍔犺浇log
-                        Loading loading = new Loading();
-                        view.AddChidren(loading);
-                        loading.Start();
-                        new System.Threading.Thread(() =>
+                        Thread(view, (responsePackNew) =>
                         {
-                            try
-                            {
-                                responsePackNew = PirSend.DeviceRename(pirclick.deviceId, pirclick.name);
-                            }
-                            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();
+                            pirclick.name = name;
+                            view.Close();
+                            UIView(vv);
+                        }, "淇敼鍚嶇О", pirclick.deviceId, pirclick.name);
                     }, () =>
                     {
                         NewSwitchView(pirclick, vv);
@@ -438,40 +202,12 @@
                     TipPopView tipPopView = new TipPopView();
                     tipPopView.TipBox(StringId.tip, text, (dialog) =>
                     {
-                        HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-                        //鍔犺浇log
-                        Loading loading = new Loading();
-                        dialog.AddChidren(loading);
-                        loading.Start();
-                        new System.Threading.Thread(() =>
+
+                        Thread(dialog, (responsePackNew) =>
                         {
-                            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();
+                            dialog.Close();
+                            UIView(vv);
+                        }, "鍒犻櫎", pirclick.deviceId, "");
                     }, () =>
                     {
                         NewSwitchView(pirclick, vv);
@@ -480,7 +216,56 @@
                 }
             });
         }
+        /// <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/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index cc1412a..d0745a8 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -320,6 +320,22 @@
             { IsBackground = true }.Start();
         }
         /// <summary>
+        /// 鍙戦�佸懡浠ょ嚎绋�
+        /// </summary>
+        /// <param name="control">鍙戦�佹暟鎹璞�</param>
+        /// <param name="action">鍥炶皟鍑芥暟</param>
+        /// <param name="str">鍒ゆ柇瀛楃</param>
+        /// <param name="frame">log鐖舵帶浠�</param>
+        /// <param name="dialog">log鐖舵帶浠�</param>
+        public void ThreadSend(Control control, Action<HDL_ON.DAL.Server.ResponsePackNew> action, string str, FrameLayout frame, Dialog dialog)
+        {
+
+
+
+        }
+
+
+        /// <summary>
         /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁
         /// </summary>
         public static string mqttdata = ""; 
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs
new file mode 100644
index 0000000..a2caf6c
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/ControlView.cs
@@ -0,0 +1,113 @@
+锘縰sing System;
+using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
+using Shared;
+
+namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View
+{
+    public class ControlView
+    {
+        /// <summary>
+        /// 鐖舵帶浠�
+        /// </summary>
+        public RowLayout funControlRow = new RowLayout
+        {
+            Width = Application.GetRealWidth(375 - 16 * 2),
+            Height = Application.GetRealHeight(50),
+            LineColor = CSS.CSS_Color.textWhiteColor,
+            SubViewWidth = Application.GetRealWidth(68),
+        };
+        /// <summary>
+        /// 閬ユ帶鍣ㄥ悕绉�
+        /// </summary>
+        public Button nameBtn = new Button
+        {
+            X = Application.GetRealWidth(16),
+            Width = Application.GetRealWidth(150),
+            Height = Application.GetRealHeight(20),
+            //Text = control.name,
+            TextAlignment = TextAlignment.CenterLeft,
+            TextSize = TextSize.text14,
+            TextColor = CSS.CSS_Color.textColor,
+            Gravity = Gravity.CenterVertical,
+        };
+
+        /// <summary>
+        /// 閬ユ帶鍣ㄥ尯鍩�
+        /// </summary>
+        public Button areaBtn = new Button
+        {
+            X = Application.GetRealWidth(311 + 16 - (40 + 100)),
+            Width = Application.GetRealWidth(100),
+            Height = Application.GetRealHeight(17),
+            //Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control),
+            TextAlignment = TextAlignment.CenterRight,
+            TextSize = TextSize.text12,
+            TextColor = CSS.CSS_Color.textCancelColor,
+            Gravity = Gravity.CenterVertical,
+        };
+
+        /// <summary>
+        /// 涓嬩竴绾у浘鏍�
+        /// </summary>
+        public Button nextIconBtn = new Button
+        {
+            X = Application.GetRealWidth(295 + 16),
+            Width = Application.GetRealWidth(16),
+            Height = Application.GetRealWidth(16),
+            UnSelectedImagePath = "PirIcon/next.png",
+            Gravity = Gravity.CenterVertical,
+        };
+
+
+        /// <summary>
+        /// 鍒犻櫎
+        /// </summary>
+        public Button delBtn = new Button
+        {
+            Width = Application.GetRealWidth(50),
+            Height = Application.GetRealHeight(22),
+            TextID = StringId.Del,
+            TextAlignment = TextAlignment.Center,
+            TextSize = TextSize.text16,
+            TextColor = CSS.CSS_Color.textWhiteColor,
+            IsBold = true,
+            BackgroundColor = CSS.CSS_Color.textRedColor,
+            //Tag = control,
+        };
+
+        /// <summary>
+        /// 绾�
+        /// </summary>
+        public Button line1Btn = new Button
+        {
+            Y = Application.GetRealHeight(50 - 2),
+            X = Application.GetRealWidth(16),
+            Width = Application.GetRealWidth(311),
+            Height = 1,
+            BackgroundColor = CSS.CSS_Color.viewLine,
+        };
+        /// <summary>
+        /// 鐐瑰嚮浜嬩欢
+        /// </summary>
+        public Button clickBtn = new Button
+        {
+            Width = Application.GetRealWidth(375 - 16 * 2),
+            Height = Application.GetRealHeight(50),
+        };
+        /// <summary>
+        /// view鏂规硶
+        /// </summary>
+        /// <param name="frame"></param>
+        public void Show(FrameLayout frame, int i)
+        {
+            funControlRow.Y = Application.GetRealHeight(92 + (50 * i));
+            frame.AddChidren(funControlRow);
+            funControlRow.AddChidren(nameBtn);
+            funControlRow.AddChidren(areaBtn);
+            funControlRow.AddChidren(nextIconBtn);
+            funControlRow.AddRightView(delBtn);
+            funControlRow.AddChidren(line1Btn);
+            funControlRow.AddChidren(clickBtn);
+        }
+    }
+}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs
new file mode 100644
index 0000000..37368a5
--- /dev/null
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs
@@ -0,0 +1,174 @@
+锘縰sing System;
+using HDL_ON.UI.UI2.Intelligence.Automation.LogicView;
+using Shared;
+namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice.View
+{
+    public class PirView
+    {
+
+        /// <summary>
+        /// 鐖舵帶浠�
+        /// </summary>
+        public FrameLayout devfLayout = new FrameLayout
+        {
+            Y = Application.GetRealHeight(12),
+            X = Application.GetRealWidth(16),
+            Width = Application.GetRealWidth(375 - 16 * 2),
+            // Height = Application.GetRealHeight(92 + (50 * pirDevice.FunctioList.Count)),
+            BackgroundColor = CSS.CSS_Color.view,
+            Radius = (uint)Application.GetRealHeight(12),
+        };
+        /// <summary>
+        /// 鍥炬爣
+        /// </summary>
+        public Button priequipmentBtn = new Button
+        {
+            Y = Application.GetRealHeight(16),
+            X = Application.GetRealWidth(5),
+            Width = Application.GetRealWidth(60),
+            Height = Application.GetRealWidth(60),
+            UnSelectedImagePath = "PirIcon/priequipment.png",
+            TextAlignment = TextAlignment.Center,
+        };
+
+        /// <summary>
+        /// 鍚嶇О
+        /// </summary>
+        public Button deviceNameBtn = new Button
+        {
+            Y = Application.GetRealHeight(16),
+            X = Application.GetRealWidth(72),
+            Width = Application.GetRealWidth(120),
+            Height = Application.GetRealHeight(20),
+            //Text = pirDevice.name,
+            TextAlignment = TextAlignment.CenterLeft,
+            TextSize = TextSize.text14,
+            TextColor = CSS.CSS_Color.textColor,
+            IsBold = true,
+        };
+
+
+        /// <summary>
+        /// 鐗堟湰鍙�
+        /// </summary>
+        public Button versionBtn = new Button
+        {
+            Y = Application.GetRealHeight(40),
+            X = Application.GetRealWidth(72),
+            Width = Application.GetRealWidth(120),
+            Height = Application.GetRealHeight(17),
+            Text = "鐗堟湰鍙穠1.3.5",
+            TextAlignment = TextAlignment.CenterLeft,
+            TextSize = TextSize.text12,
+            TextColor = CSS.CSS_Color.textCancelColor,
+        };
+
+        /// <summary>
+        /// 褰撳墠涓暟
+        /// </summary>
+        public Button geBtn = new Button
+        {
+            Y = Application.GetRealHeight(59),
+            X = Application.GetRealWidth(72),
+            Width = Application.GetRealWidth(120),
+            Height = Application.GetRealHeight(17),
+            //Text = pirDevice.FunctioList.Count.ToString(),
+            TextAlignment = TextAlignment.CenterLeft,
+            TextSize = TextSize.text12,
+            TextColor = CSS.CSS_Color.textConfirmColor,
+        };
+
+        /// <summary>
+        /// 鎬绘暟
+        /// </summary>
+        public Button sumBtn = new Button
+        {
+            Y = Application.GetRealHeight(59),
+
+            Width = Application.GetRealWidth(20),
+            Height = Application.GetRealHeight(17),
+            Text = "/10",
+            TextAlignment = TextAlignment.CenterLeft,
+            TextSize = TextSize.text12,
+            TextColor = CSS.CSS_Color.textCancelColor,
+        };
+
+        /// <summary>
+        /// 鐘舵�佸浘鏍�
+        /// </summary>
+        public Button stateIconBtn = new Button
+        {
+            Y = Application.GetRealHeight(23),
+            X = Application.GetRealWidth(291),
+            Width = Application.GetRealWidth(8),
+            Height = Application.GetRealWidth(8),
+            UnSelectedImagePath = "PirIcon/online.png",
+            SelectedImagePath = "PirIcon/offline.png",
+        };
+
+        /// <summary>
+        /// 绾㈠瀹濈姸鎬侊紙鍦ㄧ嚎-绂荤嚎锛�
+        /// </summary>
+        public Button stateTextBtn = new Button
+        {
+            Y = Application.GetRealHeight(18),
+            X = Application.GetRealWidth(303),
+            Width = Application.GetRealWidth(30),
+            Height = Application.GetRealHeight(17),
+            TextID = StringId.zaixianhwb,
+            TextAlignment = TextAlignment.CenterLeft,
+            TextSize = TextSize.text12,
+            TextColor = 0xFF67D569,// CSS.CSS_Color.textColor,
+            SelectedTextColor = CSS.CSS_Color.textRedColor,
+            IsBold = true,
+        };
+        /// <summary>
+        /// 绾�
+        /// </summary>
+        public Button lineBtn = new Button
+        {
+            Y = Application.GetRealHeight(92) - 1,
+            X = Application.GetRealWidth(16),
+            Width = Application.GetRealWidth(343 - 16 * 2),
+            Height = 1,
+            BackgroundColor = CSS.CSS_Color.viewLine,
+        };
+
+        /// <summary>
+        /// 鐐瑰嚮浜嬩欢
+        /// </summary>
+        public Button clickBtn = new Button
+        {
+            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],
+        };
+        /// <summary>
+        /// view鏂规硶
+        /// </summary>
+        /// <param name="i"></param>
+        /// <param name="fLayout"></param>
+        public void Show(int i, FrameLayout fLayout)
+        {
+
+
+            fLayout.AddChidren(devfLayout);
+            devfLayout.Height = Application.GetRealHeight(92 + (50 * i));
+            devfLayout.AddChidren(priequipmentBtn);
+            devfLayout.AddChidren(deviceNameBtn);
+            devfLayout.AddChidren(versionBtn);
+            devfLayout.AddChidren(geBtn);
+            geBtn.Width = geBtn.GetTextWidth();
+            devfLayout.AddChidren(sumBtn);
+            sumBtn.X = geBtn.Right;
+            devfLayout.AddChidren(stateIconBtn);
+            devfLayout.AddChidren(stateTextBtn);
+            devfLayout.AddChidren(lineBtn);
+            devfLayout.AddChidren(clickBtn);
+        }
+    }
+}

--
Gitblit v1.8.0