From a3313818a548d51777ae4e6cc006e9d1e2c1036e Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 07 四月 2023 09:15:37 +0800
Subject: [PATCH] 群控备份

---
 HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs |   95 ++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 81 insertions(+), 14 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
index 5805d72..886a2f0 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
@@ -1,5 +1,6 @@
 锘縰sing System;
 using System.Collections.Generic;
+using HDL_ON.Common;
 using HDL_ON.DAL.Server;
 using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
@@ -26,7 +27,7 @@
                     {
                         var page = new AddGroupControlPage(null,
                             ()=> {
-
+                                ReadGroupControlList();
                             });
                         MainPage.BasePageView.AddChidren(page);
                         page.LoadPage();
@@ -43,13 +44,27 @@
             };
             bodyView.AddChidren(contentView);
 
+            ReadGroupControlList();
+
+            #region 
+            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
+
+            
+
+            #endregion
+
+        }
+        /// <summary>
+        /// 璇诲彇缁勬帶鏁版嵁
+        /// </summary>
+        private void ReadGroupControlList()
+        {
 
             new System.Threading.Thread(() => {
-                var http = new HttpServerRequest();
-                var pack = http.GetGroupControlList();
-                if(pack != null)
+                var pack = ApiUtlis.Ins.HttpRequest.GetGroupControlList();
+                if (pack != null)
                 {
-                    if(pack.Code == StateCode.SUCCESS  )
+                    if (pack.Code == StateCode.SUCCESS)
                     {
                         try
                         {
@@ -69,14 +84,8 @@
                         IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                     }
                 }
-            }) { IsBackground = true }.Start();
-
-            #region 
-            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
-
-            
-
-            #endregion
+            })
+            { IsBackground = true }.Start();
 
         }
 
@@ -117,10 +126,11 @@
 
                 foreach (var groupControl in list)
                 {
-                    var functionRow = new FrameLayout()
+                    var functionRow = new RowLayout()
                     {
                         Height = Application.GetRealHeight(65),
                         BackgroundColor = CSS_Color.MainBackgroundColor,
+                        LineColor = 0x00000000
                     };
                     contentView.AddChidren(functionRow);
 
@@ -186,6 +196,63 @@
                     btnFunctionName.MouseUpEventHandler = eventHandler;
                     btnFunctionLocationInfo.MouseUpEventHandler = eventHandler;
 
+                    var btnDelGroupControl = new Button()
+                    {
+                        TextColor = CSS_Color.MainBackgroundColor,
+                        BackgroundColor = CSS_Color.WarningColor,
+                        TextID = StringId.Del,
+                        TextAlignment = TextAlignment.Center,
+                    };
+                    functionRow.AddRightView(btnDelGroupControl);
+                    btnDelGroupControl.MouseUpEventHandler = (sender1, e1) => {
+                        var waitPage = new Loading();
+                        this.AddChidren(waitPage);
+                        waitPage.Start("");
+                        new System.Threading.Thread(() =>
+                        {
+                            try
+                            {
+                                var pack = ApiUtlis.Ins.HttpRequest.DelGroupControl(groupControl.userDeviceGroupControlId);
+                                if (pack != null)
+                                {
+                                    Application.RunOnMainThread(() =>
+                                    {
+                                        try
+                                        {
+                                            if (pack.Code == StateCode.SUCCESS)
+                                            {
+                                                list.Remove(groupControl);
+                                                LoadGroupControlView(list);
+                                            }
+                                            else
+                                            {
+                                                IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+                                            }
+                                        }catch(Exception ex)
+                                        {
+                                            MainPage.Log($"鍒锋柊缁勬帶鏁版嵁寮傚父:{ex.Message}");
+                                        }
+                                    });
+                                }
+                            }catch(Exception ex)
+                            {
+                                MainPage.Log($"鍒犻櫎缁勬帶寮傚父:{ex.Message}");
+                            }
+                            finally
+                            {
+                                Application.RunOnMainThread(() => {
+                                    if (waitPage != null)
+                                    {
+                                        waitPage.Hide();
+                                        waitPage.RemoveFromParent();
+                                        waitPage = null;
+                                    }
+                                });
+                            }
+                        })
+                        { IsBackground = true }.Start();
+                    };
+
                 }
 
             }

--
Gitblit v1.8.0