From 53189866ba4012fec0b40990fd2281b836fa2668 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 01 七月 2020 16:29:16 +0800
Subject: [PATCH] 20200701

---
 HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs |  168 +++++++++++++++++++++++--------------------------------
 1 files changed, 71 insertions(+), 97 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs
index 80e864e..9512ce2 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs
@@ -8,18 +8,24 @@
 
 namespace HDL_ON.UI
 {
-    public class MemberFunctionPermissionPage : FrameLayout
+    public partial class MemberFunctionPermissionPage : FrameLayout
     {
         MemberFunctionPermissionPage bodyView;
-
+        FrameLayout allRoomView;
+        /// <summary>
+        /// 鍏ㄩ�夋寜閽�
+        /// </summary>
         Button btnChooseAll;
+        /// <summary>
+        /// 鍔熻兘鏄剧ず鍖哄煙
+        /// </summary>
+        VerticalScrolViewLayout contentView;
 
         ResidenceMemberInfo memberInfo;
 
         Room room;
 
         List<Function> funs;
-
 
         public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, Room r)
         {
@@ -33,11 +39,20 @@
                     CommonPage.MyEncodingUTF8.GetString(memberInfo.CurShareData.ShareDataBytes));
             }
         }
-        public void LoadPage()
-        {
-            new TopViewDiv(bodyView, Language.StringByID(StringId.PermissionToUse)).LoadTopView();
 
-            var allRoomView = new FrameLayout()
+        public MemberFunctionPermissionPage(Room r)
+        {
+            bodyView = this;
+            room = r;
+            funs = new List<Function>();
+            funs.AddRange(r.functions);
+        }
+
+        public void LoadPage(int titleId)
+        {
+            new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView();
+
+            allRoomView = new FrameLayout()
             {
                 Y = Application.GetRealHeight(64),
                 Height = Application.GetRealHeight(50),
@@ -49,7 +64,7 @@
             {
                 X = Application.GetRealWidth(16),
                 Width = Application.GetRealWidth(280),
-                TextID = StringId.All,
+                TextID = StringId.SelectedAll,
                 TextSize = CSS_FontSize.SubheadingFontSize,
                 TextColor = CSS_Color.FirstLevelTitleColor,
                 TextAlignment = TextAlignment.CenterLeft,
@@ -77,13 +92,58 @@
                 BackgroundColor = CSS_Color.DividingLineColor,
             });
 
-            var contentView = new VerticalScrolViewLayout()
+            contentView = new VerticalScrolViewLayout()
             {
                 Y = Application.GetRealHeight(64+50),
                 Height = Application.GetRealHeight(450),
             };
             bodyView.AddChidren(contentView);
 
+            var btnOption = new Button()
+            {
+                Y = Application.GetRealHeight(519+64),
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(220),
+                Height = Application.GetRealHeight(44),
+                BackgroundColor = CSS_Color.MainColor,
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.MainBackgroundColor,
+                TextID = titleId == StringId.PermissionToUse ? StringId.Confirm : StringId.Shared,
+                TextSize = CSS_FontSize.SubheadingFontSize,
+                IsBold = true,
+                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();
+
+            LoadEventList();
+        }
+        /// <summary>
+        /// 鍔犺浇鍔熻兘鍒楄〃
+        /// </summary>
+        void LoadFunctionRow()
+        {
+            contentView.RemoveAll();
             foreach (var function in room.functions)
             {
                 var roomView = new FrameLayout()
@@ -116,7 +176,7 @@
                     Tag = "ChooseIcon"
                 };
                 roomView.AddChidren(btnChoose);
-                if (funs.Find((obj)=>obj.sid == function.sid) != null)
+                if (funs.Find((obj) => obj.sid == function.sid) != null)
                 {
                     btnChoose.IsSelected = true;
                     funs.Add(function);
@@ -126,30 +186,7 @@
                     if (btnChooseAll.IsSelected)
                         btnChooseAll.IsSelected = false;
                 }
-
-                EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
-                {
-                    btnChoose.IsSelected = !btnChoose.IsSelected;
-                    if (btnChoose.IsSelected)
-                    {
-                        try
-                        {
-                            funs.Add(function);
-                        }
-                        catch (Exception ex)
-                        {
-                            MainPage.Log($"Evhaaa {ex.Message}");
-                        }
-                    }
-                    else
-                    {
-                        funs.Remove(function);
-                    }
-                };
-
-                btnChoose.MouseUpEventHandler = eventHandler;
-                btnRoomText.MouseUpEventHandler = eventHandler;
-                roomView.MouseUpEventHandler = eventHandler;
+                LoadEvent_SharedDataChange(btnChoose, btnRoomText, roomView, function);
 
                 var btnLine = new Button()
                 {
@@ -161,71 +198,8 @@
                 };
                 roomView.AddChidren(btnLine);
             }
-
-            var btnOption = new Button()
-            {
-                Y = Application.GetRealHeight(519+64),
-                Gravity = Gravity.CenterHorizontal,
-                Width = Application.GetRealWidth(220),
-                Height = Application.GetRealHeight(44),
-                BackgroundColor = CSS_Color.MainColor,
-                TextAlignment = TextAlignment.Center,
-                TextColor = CSS_Color.MainBackgroundColor,
-                TextID = StringId.Confirm,
-                TextSize = CSS_FontSize.SubheadingFontSize,
-                IsBold = true,
-                Radius = (uint) Application.GetRealWidth(22),
-                BorderColor = 0x00000000,
-                BorderWidth = 0,
-            };
-            bodyView.AddChidren(btnOption);
-            btnOption.MouseUpEventHandler = (sender, e) => {
-                var act = TipLoadingMsg(Language.StringByID(StringId.SavingPleaseWait));
-                memberInfo.CurShareData.ShareDataBytes = CommonPage.MyEncodingUTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs));
-                EditShareData();
-                act();
-            };
         }
 
-        void EditShareData()
-        {
-            if (memberInfo.CurShareData.ShareName == "")
-            {
-                var ssdd = new ShareData();
-                ssdd.ShareName = DB_ResidenceData.residenceData.residecenInfo.RegionID;
-                ssdd.HouseDistributedMark = DB_ResidenceData.residenceData.residecenInfo.RegionID;
-                ssdd.ShareDataBytes = CommonPage.MyEncodingUTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs));
-                ssdd.SubAccountDistributedMark = memberInfo.SubAccountDistributedMark;
-                ResponsePack responePack = new HttpServerRequest().AddShareData(ssdd);
-                if (responePack.StateCode.ToUpper() != "SUCCESS")
-                {
-                    new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.OperationFailed), true);
-                    return;
-                }
-                else
-                {
-                    ssdd.DistributedMark = responePack.ResponseData.ToString();
-                }
-                memberInfo.CurShareData = ssdd;
-            }
-            else
-            {
-                UpdataShareData();
-            }
-        }
-
-        void UpdataShareData()
-        {
-            ResponsePack responePack = new HttpServerRequest().EditShareData(memberInfo.CurShareData);
-            if (responePack.StateCode.ToUpper() == "SUCCESS")
-            {
-                new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.SavedSuccessfully), true);
-            }
-            else
-            {
-                new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.OperationFailed), true);
-            }
-        }
 
         Action TipLoadingMsg(string msg)
         {

--
Gitblit v1.8.0