From eda3fb873e59544ff36301b51e05aef64f87b0f9 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 27 八月 2021 13:21:21 +0800
Subject: [PATCH] Merge branch 'newBranch1' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into newBranch1

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs |  107 +++++++++++------------------------------------------
 1 files changed, 23 insertions(+), 84 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
index 4835344..fea62b3 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
@@ -9,9 +9,9 @@
     {
         public AddControl()
         {
-            Tag = "AddControl";
+            Tag = "PirView";
         }
-        public void Show()
+        public void Show(Control control)
         {
 
             #region 鐣岄潰甯冨眬
@@ -24,8 +24,7 @@
             this.AddChidren(topView.FLayoutView());
             topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
             {
-                //杩斿洖娓呯┖鍒楄〃
-                Pir.BuottonList.Clear();
+
                 this.RemoveFromParent();
 
             };
@@ -57,7 +56,7 @@
             FrameLayout frameLayout = new FrameLayout
             {
                 Y = Application.GetRealHeight(64 + 84),
-                Height = Application.GetRealHeight(667 - 64 - 84),
+                Height = Application.GetRealHeight(667 - 64 - 84-104),
                 Width = Application.GetRealWidth(TextSize.view375),
             };
             this.AddChidren(frameLayout);
@@ -72,7 +71,7 @@
             };
             this.AddChidren(saveLayout);
             saveLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
-
+            //鏆傛椂闅愯棌鎺掑簭鍔熻兘
             Button paixuBtn = new Button
             {
                 Width = Application.GetRealWidth(375 - 16 * 2),
@@ -83,7 +82,7 @@
                 TextSize = TextSize.text14,
                 TextColor = CSS.CSS_Color.textTipColor,
             };
-            saveLayout.AddChidren(paixuBtn);
+            //saveLayout.AddChidren(paixuBtn);
 
             Button saveBtn = new Button
             {
@@ -104,7 +103,7 @@
 
             VerticalScrolViewLayout vv = new VerticalScrolViewLayout();
             frameLayout.AddChidren(vv);
-            RefreshView(vv, false);
+            RefreshView(vv, false, control);
             #endregion
 
             #region  鐣岄潰鐐瑰嚮浜嬩欢
@@ -118,13 +117,13 @@
                     topView.topIconBtn.Text = Language.StringByID(StringId.wancheng);
                     topView.topIconBtn.TextSize = TextSize.text14;
                     topView.topIconBtn.TextColor = CSS.CSS_Color.textColor;
-                    RefreshView(vv, true);
+                    RefreshView(vv, true, control);
                 }
                 else
                 {
                     topView.topIconBtn.UnSelectedImagePath = "PirIcon/del.png";
                     topView.topIconBtn.Text = "";
-                    RefreshView(vv, false);
+                    RefreshView(vv, false, control);
                 }
 
 
@@ -135,19 +134,19 @@
             {
                 AddButton addButton = new AddButton();
                 MainPage.BasePageView.AddChidren(addButton);
-                addButton.Show();
+                addButton.Show(control);
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             };
             //淇濆瓨鐐瑰嚮浜嬩欢
             saveBtn.MouseUpEventHandler += (sender, e) =>
             {
-                //淇濆瓨閬ユ帶鍣ㄦ竻闄や箣鍓嶆寜閽垪琛ㄧ殑鏁版嵁
-                Pir.BuottonList.Clear();
+                //绉婚櫎褰撳墠鐣岄潰
+                this.RemoveFromParent();
                 //鍙兘涔嬪墠宸茬粡瀛樺湪璇ョ晫闈�
-                MainPage.BasePageView.RemoveViewByTag("Pir");
+                PirMethod.RemoveView("AddControlComplete");
                 AddControlComplete addControlComplete = new AddControlComplete();
                 MainPage.BasePageView.AddChidren(addControlComplete);
-                addControlComplete.Show();
+                addControlComplete.Show(control, false);
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             };
             #endregion
@@ -157,82 +156,22 @@
         /// </summary>
         /// <param name="vv">涓婁笅婊戝姩鎺т欢</param>
         /// <param name="if_bool">琛ㄧず鏄惁鏄剧ず鍒犻櫎鍥炬爣</param>
-        void RefreshView(VerticalScrolViewLayout vv, bool if_bool)
+        void RefreshView(VerticalScrolViewLayout vv, bool if_bool, Control control)
         {
             vv.RemoveAll();
-            //瀹氫箟涓�涓彉閲忚褰曡鏁�
-            int sum = 0;
-            if (Pir.BuottonList.Count % 3 == 0)
+            View.Buttons buttons = new View.Buttons();
+            buttons.AddButton2(vv, control.status, (obj) =>
             {
-                sum = Pir.BuottonList.Count / 3;
-            }
-            else
-            {
-                sum = Pir.BuottonList.Count / 3 + 1;
-            }
-            //璁$畻鍔犺浇鍑烘潵鐨勬暟鎹渶瑕佺殑楂樺害
-            int h = 16 + sum * (16 + 44) + 104 + 76;
-            int line = 0;
-            //鎸夐挳鐨勭埗鎺т欢
-            var FLayout = new FrameLayout
-            {
-                Height = Application.GetRealWidth(h),
-            };
-            vv.AddChidren(FLayout);
-            for (int i = 1, j = 0; i <= Pir.BuottonList.Count; i++, j++)
-            {
-                var nameObj = Pir.BuottonList[i - 1];
-                //鎸夐挳
-                var buttonNameBtn = new Button
+                PirMethod.ThreadSend(control, (responsePackNew) =>
                 {
-
-                    Y = Application.GetRealHeight(16 + line * (16 + 44)),
-                    X = Application.GetRealWidth(16 + (16 + 104) * j),
-                    Width = Application.GetRealWidth(104),
-                    Height = Application.GetRealHeight(44),
-                    Text = nameObj.value,
-                    TextSize = TextSize.text16,
-                    TextColor = CSS.CSS_Color.textColor,
-                    TextAlignment = TextAlignment.Center,
-                    Radius = (uint)Application.GetRealHeight(18),
-                    BorderWidth = 1,
-                    BorderColor = CSS.CSS_Color.textCancelColor,
-                };
-                FLayout.AddChidren(buttonNameBtn);
-                //鍒犻櫎鍥炬爣
-                var delIconBtn = new Button
-                {
-                    UnSelectedImagePath = "PirIcon/delbuton.png",
-                    Y = Application.GetRealHeight(12 + line * (16 + 44)),
-                    X = Application.GetRealWidth((16 + 92) + (104 + 16) * j),
-                    Width = Application.GetRealWidth(16),
-                    Height = Application.GetRealWidth(16),
-                    Tag = nameObj.value,
-                };
-                if (if_bool)
-                {
-                    FLayout.AddChidren(delIconBtn);
-                }
-                //鍒犻櫎鍥炬爣鐨勭偣鍑讳簨浠�
-                delIconBtn.MouseUpEventHandler += (sender, e) =>
-                {
-                    var name = delIconBtn.Tag.ToString();
-                    var buttonObj = Pir.BuottonList.Find((c) => c.value == name);
+                    var buttonObj = control.status.Find((c) => c.value == obj.value);
                     if (buttonObj != null)
                     {
-                        Pir.BuottonList.Remove(buttonObj);
+                        control.status.Remove(buttonObj);
                     }
-                    RefreshView(vv, true);
-                };
-                if (i % 3 == 0)
-                {
-                    //婊′竴琛岄噸缃甹=0鍊�;
-                    j = -1;
-                    line += 1;
-                }
-
-            }
-
+                    RefreshView(vv, true, control);
+                }, "鍒犻櫎鎸夐敭", "fram", this, null, obj);
+            }, if_bool);
         }
     }
 }

--
Gitblit v1.8.0