From 17c8d94258154ab2e9f6d2cf821202c873b9f118 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 16 十二月 2020 15:39:15 +0800
Subject: [PATCH] 22222
---
HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs | 258 ++++++++++++++++++++-------------------------------
1 files changed, 100 insertions(+), 158 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..172eb57 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/MemberFunctionPermissionPage.cs
@@ -8,36 +8,75 @@
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;
+ /// <summary>
+ /// 搴曢儴鎿嶄綔鎸夐挳
+ /// </summary>
+ Button btnOption;
+ /// <summary>
+ /// 椤甸潰鏍囬ID
+ /// </summary>
+ int titleId;
ResidenceMemberInfo memberInfo;
Room room;
- List<Function> funs;
+ Action<string> refreshFunctionCount;
+ /// <summary>
+ /// 涔嬪墠鐨勫垎浜垪琛�
+ /// </summary>
+ List<ShareData> funs;
+ /// <summary>
+ /// 灞炰簬褰撳墠鎴块棿鏈�缁堢殑璁惧鍒嗕韩鍒楄〃
+ /// </summary>
+ List<ShareData> funs_New;
+ /// <summary>
+ /// 鍒犻櫎鐨勫垎浜垪琛�
+ /// </summary>
+ List<ShareData> funs_Del;
- public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, Room r)
+ 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));
- }
- }
- public void LoadPage()
- {
- new TopViewDiv(bodyView, Language.StringByID(StringId.PermissionToUse)).LoadTopView();
+ funs = new List<ShareData>();
+ funs = memberInfo.CurResidenceShareDate;
+ funs_New = new List<ShareData>();
+ funs_Del = new List<ShareData>();
- var allRoomView = new FrameLayout()
+ refreshFunctionCount = action;
+ }
+
+ public MemberFunctionPermissionPage(Room r,List<ShareData> sd)
+ {
+ bodyView = this;
+ room = r;
+ funs = new List<ShareData>();
+ funs_New = sd;
+ funs_Del = new List<ShareData>();
+ memberInfo = new ResidenceMemberInfo();
+ }
+
+ public void LoadPage(int tId)
+ {
+ titleId = tId;
+ new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView();
+
+ allRoomView = new FrameLayout()
{
Y = Application.GetRealHeight(64),
Height = Application.GetRealHeight(50),
@@ -49,7 +88,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,14 +116,48 @@
BackgroundColor = CSS_Color.DividingLineColor,
});
- var contentView = new VerticalScrolViewLayout()
+ contentView = new VerticalScrolViewLayout()
{
Y = Application.GetRealHeight(64+50),
Height = Application.GetRealHeight(450),
};
bodyView.AddChidren(contentView);
- foreach (var function in room.functions)
+ btnOption = new Button()
+ {
+ Y = Application.GetRealHeight(519 + 64),
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(220),
+ Height = Application.GetRealWidth(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);
+
+ if(titleId == StringId.PermissionToUse)
+ {
+ LoadFunctionRow(funs);
+ }
+ else
+ {
+ LoadFunctionRow(funs_New);
+ }
+ LoadEventList();
+ }
+ /// <summary>
+ /// 鍔犺浇鍔熻兘鍒楄〃
+ /// </summary>
+ void LoadFunctionRow(List<ShareData> shareDatas)
+ {
+ contentView.RemoveAll();
+ foreach (var function in room.GetRoomFunctions(false))
{
var roomView = new FrameLayout()
{
@@ -116,162 +189,31 @@
Tag = "ChooseIcon"
};
roomView.AddChidren(btnChoose);
- if (funs.Find((obj)=>obj.sid == function.sid) != null)
+
+ var shareData = shareDatas.Find((obj) => obj.shareTypeId == function.deviceId);
+ if (shareData != null)
{
btnChoose.IsSelected = true;
- funs.Add(function);
+ //鍒锋柊灞炰簬褰撳墠鎴块棿鐨勫垎浜粺璁�
+ funs_New.Add(shareData);
}
else
{
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;
+ LoadMethod_SharedDataChange(btnChoose, btnRoomText, roomView, function);
var btnLine = new Button()
{
Gravity = Gravity.CenterHorizontal,
- Y = Application.GetRealHeight(49),
- Height = Application.GetMinReal(1),
+ //Y = Application.GetRealHeight(49),
+ Height = Application.GetRealHeight(1),
Width = Application.GetRealWidth(343),
BackgroundColor = CSS_Color.DividingLineColor,
};
- roomView.AddChidren(btnLine);
+ contentView.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)
- {
- 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