using System;
|
using Shared;
|
using HDL_ON.Entity;
|
using HDL_ON.UI.CSS;
|
using System.Collections.Generic;
|
using HDL_ON.DAL;
|
using HDL_ON.DAL.Server;
|
|
namespace HDL_ON.UI
|
{
|
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;
|
|
Action<string> refreshFunctionCount;
|
|
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<ShareData>();
|
funs = memberInfo.CurResidenceShareDate;
|
funs_New = new List<ShareData>();
|
funs_Del = new List<ShareData>();
|
|
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),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
};
|
bodyView.AddChidren(allRoomView);
|
|
Button btnAllRoomText = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Width = Application.GetRealWidth(280),
|
TextID = StringId.SelectedAll,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
allRoomView.AddChidren(btnAllRoomText);
|
|
btnChooseAll = new Button()
|
{
|
X = Application.GetRealWidth(331),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(28),
|
Height = Application.GetMinRealAverage(28),
|
UnSelectedImagePath = "Public/ChooseIcon.png",
|
SelectedImagePath = "Public/ChooseOnIcon.png",
|
IsSelected = true,
|
};
|
allRoomView.AddChidren(btnChooseAll);
|
|
allRoomView.AddChidren(new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(49),
|
Height = Application.GetMinReal(1),
|
Width = Application.GetRealWidth(343),
|
BackgroundColor = CSS_Color.DividingLineColor,
|
});
|
|
contentView = new VerticalScrolViewLayout()
|
{
|
Y = Application.GetRealHeight(64+50),
|
Height = Application.GetRealHeight(450),
|
};
|
bodyView.AddChidren(contentView);
|
|
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);
|
|
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.functions)
|
{
|
var roomView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(50),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Tag = "row"
|
};
|
contentView.AddChidren(roomView);
|
|
Button btnRoomText = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Width = Application.GetRealWidth(280),
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
Text = function.name,
|
};
|
roomView.AddChidren(btnRoomText);
|
|
Button btnChoose = new Button()
|
{
|
X = Application.GetRealWidth(331),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(28),
|
Height = Application.GetMinRealAverage(28),
|
UnSelectedImagePath = "Public/ChooseIcon.png",
|
SelectedImagePath = "Public/ChooseOnIcon.png",
|
Tag = "ChooseIcon"
|
};
|
roomView.AddChidren(btnChoose);
|
if (shareDatas.Find((obj) => obj.ShareName == function.sid) != null)
|
{
|
btnChoose.IsSelected = true;
|
}
|
else
|
{
|
if (btnChooseAll.IsSelected)
|
btnChooseAll.IsSelected = false;
|
}
|
LoadMethod_SharedDataChange(btnChoose, btnRoomText, roomView, function);
|
|
var btnLine = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
//Y = Application.GetRealHeight(49),
|
Height = Application.GetRealHeight(1),
|
Width = Application.GetRealWidth(343),
|
BackgroundColor = CSS_Color.DividingLineColor,
|
};
|
contentView.AddChidren(btnLine);
|
}
|
}
|
|
}
|
}
|