From 23c075a9c27946773feccf05abc90489a6bf5203 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 06 七月 2020 15:58:53 +0800
Subject: [PATCH] 20200706

---
 HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs |  127 +++++++++++++----------------------------
 1 files changed, 41 insertions(+), 86 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs
index 9512ce2..fb69eb6 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs
@@ -20,36 +20,51 @@
         /// 鍔熻兘鏄剧ず鍖哄煙
         /// </summary>
         VerticalScrolViewLayout contentView;
+        /// <summary>
+        /// 搴曢儴鎿嶄綔鎸夐挳
+        /// </summary>
+        Button btnOption;
+        /// <summary>
+        /// 椤甸潰鏍囬ID
+        /// </summary>
+        int titleId;
 
         ResidenceMemberInfo memberInfo;
 
         Room room;
 
-        List<Function> funs;
+        Action<string> refreshFunctionCount;
 
-        public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, Room r)
+        List<ShareData> funs;
+        List<ShareData> funs_New;
+        List<ShareData> funs_Del;
+
+        public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, Room r, Action<string> action)
         {
             bodyView = this;
             memberInfo = mInfo;
             room = r;
-            funs = new List<Function>();
-            if (memberInfo.CurShareData.ShareDataBytes != null)
-            {
-                funs = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>(
-                    CommonPage.MyEncodingUTF8.GetString(memberInfo.CurShareData.ShareDataBytes));
-            }
+            funs = new List<ShareData>();
+            funs = memberInfo.CurResidenceShareDate;
+            funs_New = new List<ShareData>();
+            funs_Del = new List<ShareData>();
+
+            refreshFunctionCount = action;
         }
 
-        public MemberFunctionPermissionPage(Room r)
+        public MemberFunctionPermissionPage(Room r,List<ShareData> sd)
         {
             bodyView = this;
             room = r;
-            funs = new List<Function>();
-            funs.AddRange(r.functions);
+            funs = new List<ShareData>();
+            funs_New = sd;
+            funs_Del = new List<ShareData>();
+            memberInfo = new ResidenceMemberInfo();
         }
 
-        public void LoadPage(int titleId)
+        public void LoadPage(int tId)
         {
+            titleId = tId;
             new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView();
 
             allRoomView = new FrameLayout()
@@ -99,9 +114,9 @@
             };
             bodyView.AddChidren(contentView);
 
-            var btnOption = new Button()
+            btnOption = new Button()
             {
-                Y = Application.GetRealHeight(519+64),
+                Y = Application.GetRealHeight(519 + 64),
                 Gravity = Gravity.CenterHorizontal,
                 Width = Application.GetRealWidth(220),
                 Height = Application.GetRealHeight(44),
@@ -111,37 +126,26 @@
                 TextID = titleId == StringId.PermissionToUse ? StringId.Confirm : StringId.Shared,
                 TextSize = CSS_FontSize.SubheadingFontSize,
                 IsBold = true,
-                Radius = (uint) Application.GetRealWidth(22),
+                Radius = (uint)Application.GetRealWidth(22),
                 BorderColor = 0x00000000,
                 BorderWidth = 0,
             };
             bodyView.AddChidren(btnOption);
-            btnOption.MouseUpEventHandler = (sender, e) =>
-            {
-                if (titleId == StringId.PermissionToUse)
-                {
-                    var act = TipLoadingMsg(Language.StringByID(StringId.SavingPleaseWait));
-                    memberInfo.CurShareData.ShareDataBytes = CommonPage.MyEncodingUTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs));
-                    LoadEvent_EditShareData();
-                    act();
-                }
-                else
-                {
-                    var sharedBytes = CommonPage.MyEncodingUTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs)); 
-                    var page = new ChooseShareMemberTargetListPage(sharedBytes);
-                    MainPage.BasePageView.AddChidren(page);
-                    page.LoadPage();
-                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-                }
-            };
-            LoadFunctionRow();
 
+            if(titleId == StringId.PermissionToUse)
+            {
+                LoadFunctionRow(funs);
+            }
+            else
+            {
+                LoadFunctionRow(funs_New);
+            }
             LoadEventList();
         }
         /// <summary>
         /// 鍔犺浇鍔熻兘鍒楄〃
         /// </summary>
-        void LoadFunctionRow()
+        void LoadFunctionRow(List<ShareData>  shareDatas)
         {
             contentView.RemoveAll();
             foreach (var function in room.functions)
@@ -176,17 +180,16 @@
                     Tag = "ChooseIcon"
                 };
                 roomView.AddChidren(btnChoose);
-                if (funs.Find((obj) => obj.sid == function.sid) != null)
+                if (shareDatas.Find((obj) => obj.ShareName == function.sid) != null)
                 {
                     btnChoose.IsSelected = true;
-                    funs.Add(function);
                 }
                 else
                 {
                     if (btnChooseAll.IsSelected)
                         btnChooseAll.IsSelected = false;
                 }
-                LoadEvent_SharedDataChange(btnChoose, btnRoomText, roomView, function);
+                LoadMethod_SharedDataChange(btnChoose, btnRoomText, roomView, function);
 
                 var btnLine = new Button()
                 {
@@ -198,54 +201,6 @@
                 };
                 roomView.AddChidren(btnLine);
             }
-        }
-
-
-        Action TipLoadingMsg(string msg)
-        {
-            Dialog dialog = new Dialog()
-            {
-                X = Application.GetRealWidth(89),
-                Y = Application.GetRealHeight(285),
-                Width = Application.GetRealWidth(198),
-                Height = Application.GetRealHeight(98),
-            };
-
-            FrameLayout frame = new FrameLayout()
-            {
-                BackgroundColor = CSS_Color.DialogTransparentColor1,
-                Radius = (uint)Application.GetRealWidth(12),
-            };
-            dialog.AddChidren(frame);
-
-            Button btnTipIcon = new Button()
-            {
-                Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight(15),
-                Width = Application.GetRealWidth(32),
-                Height = Application.GetRealWidth(32),
-                UnSelectedImagePath = "Public/MsgIcon/LoadingIcon.png",
-            };
-            frame.AddChidren(btnTipIcon);
-
-            Button btnTipMsg = new Button()
-            {
-                Y = Application.GetRealHeight(47),
-                Height = Application.GetRealHeight(50),
-                TextAlignment = TextAlignment.Center,
-                TextSize = CSS_FontSize.TextFontSize,
-                TextColor = CSS_Color.MainBackgroundColor,
-                Text = msg,
-            };
-            frame.AddChidren(btnTipMsg);
-
-            //new System.Threading.Thread(() =>{
-            //});
-
-            dialog.Show();
-            return new Action(() => {
-                dialog.Close();
-            });
         }
 
     }

--
Gitblit v1.8.0