| | |
| | | public partial class MemberPermissionPage : FrameLayout |
| | | { |
| | | MemberPermissionPage bodyView; |
| | | Button btnDelMember; |
| | | |
| | | ResidenceMemberInfo memberInfo; |
| | | |
| | | public MemberPermissionPage(ResidenceMemberInfo mInfo) |
| | | Action backAction; |
| | | |
| | | public MemberPermissionPage(ResidenceMemberInfo mInfo,Action action) |
| | | { |
| | | bodyView = this; |
| | | memberInfo = mInfo; |
| | | backAction = action; |
| | | } |
| | | |
| | | public void LoadPage() |
| | |
| | | }; |
| | | contentView.AddChidren(roomListView); |
| | | |
| | | List<Function> funss = new List<Function>(); |
| | | if (memberInfo.CurShareData.ShareDataBytes != null) |
| | | { |
| | | funss = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>( |
| | | CommonPage.MyEncodingUTF8.GetString(memberInfo.CurShareData.ShareDataBytes)); |
| | | } |
| | | //List<Function> funss = new List<Function>(); |
| | | //if (memberInfo.CurResidenceShareDate.Count > 0) |
| | | //{ |
| | | // foreach (var sd in memberInfo.CurResidenceShareDate) |
| | | // { |
| | | // funss.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<ShareData>(CommonPage.MyEncodingUTF8.GetString(sd.ShareDataBytes))); |
| | | // } |
| | | //} |
| | | foreach (var room in DB_ResidenceData.residenceData.rooms) |
| | | { |
| | | var roomView = new FrameLayout() |
| | |
| | | |
| | | //计算已经加入房间的设备数量 |
| | | int addCount = 0; |
| | | foreach (var d in memberInfo.sharedDatas) |
| | | foreach (var sd in memberInfo.CurResidenceShareDate) |
| | | { |
| | | foreach(var f in funss) |
| | | if (room.functions.Find((obj) => obj.sid == sd.ShareName) != null) |
| | | { |
| | | if (room.functions.Find((obj) => obj.sid == f.sid) != null) |
| | | { |
| | | addCount++; |
| | | } |
| | | addCount++; |
| | | } |
| | | } |
| | | //移除当前住宅已经不存在的功能 |
| | | for(int i= 0;i< memberInfo.CurResidenceShareDate.Count;) |
| | | { |
| | | var sd = memberInfo.CurResidenceShareDate[i]; |
| | | if (DB_ResidenceData.residenceData.functionList.functions.Find((obj) => obj.sid == sd.ShareName) == null) |
| | | { |
| | | new DAL.Server.HttpServerRequest().DeleteShareData(sd); |
| | | memberInfo.CurResidenceShareDate.Remove(sd); |
| | | } |
| | | else |
| | | { |
| | | i++; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | EventHandler<MouseEventArgs> eHandler = (sender, e) => |
| | | { |
| | | var mmp = new MemberFunctionPermissionPage(memberInfo,room); |
| | | Action<string> refreshFunctionCount = (newCount) => { |
| | | btnFunctionCount.Text = newCount + "/" + room.functions.Count.ToString(); |
| | | }; |
| | | var mmp = new MemberFunctionPermissionPage(memberInfo, room,refreshFunctionCount); |
| | | MainPage.BasePageView.AddChidren(mmp); |
| | | mmp.LoadPage(); |
| | | mmp.LoadPage(StringId.PermissionToUse); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | roomView.MouseUpEventHandler = eHandler; |
| | | btnRoomName.MouseUpEventHandler = eHandler; |
| | | btnRight.MouseUpEventHandler = eHandler; |
| | | |
| | | |
| | | if (DB_ResidenceData.residenceData.rooms.IndexOf(room) < DB_ResidenceData.residenceData.rooms.Count - 2) |
| | | { |
| | |
| | | BackgroundColor = CSS_Color.BackgroundColor, |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | btnDelMember = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(617), |
| | | Height = MainPage.Increase ? Application.GetRealHeight(70) : Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.WarningColor, |
| | | TextID = StringId.RemoveTheMember, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(btnDelMember); |
| | | |
| | | LoadEventList(); |
| | | } |
| | | } |
| | | } |