| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = memberInfo.nickName + "(" + memberInfo.Account + ")", |
| | | //Text = memberInfo.nickName + "(" + memberInfo.UserName + ")", |
| | | }; |
| | | headPortraitView.AddChidren(btnMemberName); |
| | | string username = HDLCommon.Current.GetUserName(memberInfo.memberName); |
| | | btnMemberName.Text = memberInfo.nickName + "(" + username + ")"; |
| | | |
| | | #region RoomList |
| | | roomListView = new VerticalScrolViewLayout() |
| | |
| | | var btnLine = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = btnTitle.Bottom, |
| | | Y = titleView.Height - Application.GetRealHeight(2), |
| | | Width = Application.GetRealWidth(360), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | roomListView.AddChidren(btnLine); |
| | | titleView.AddChidren(btnLine); |
| | | |
| | | //--------------------------------------------- |
| | | //var roomListView = new VerticalScrolViewLayout() |
| | | //{ |
| | | // Y = btnLine.Bottom, |
| | | // Height = Application.GetRealHeight(440), |
| | | //}; |
| | | //contentView.AddChidren(roomListView); |
| | | //未分配区域的功能 |
| | | List<Function> allFunctionList = FunctionList.List.GetDeviceFunctionList(); |
| | | //未分配区域的功能 |
| | | List<Function> unallocatedList = new List<Function>(); |
| | | foreach (var function in allFunctionList) |
| | | { |
| | | function.roomIds.Remove(null); |
| | | if (function.roomIds.Count > 0) |
| | | { |
| | | //allocatedList.Add(function); |
| | | } |
| | | else |
| | | { |
| | | unallocatedList.Add(function); |
| | | } |
| | | } |
| | | |
| | | //List<Function> funss = new List<Function>(); |
| | | //if (memberInfo.CurResidenceShareDate.Count > 0) |
| | | //{ |
| | | // foreach (var sd in memberInfo.CurResidenceShareDate) |
| | | // { |
| | | // funss.Add(Newtonsoft.Json.JsonConvert.DeserializeObject<ShareData>(System.Text.Encoding.UTF8.GetString(sd.ShareDataBytes))); |
| | | // } |
| | | //} |
| | | //移除当前住宅已经不存在的功能 |
| | | for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;) |
| | | { |
| | | var sd = memberInfo.CurResidenceShareDate[i]; |
| | | if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null) |
| | | { |
| | | //new DAL.Server.HttpServerRequest().DeleteShareData(sd); |
| | | //待确认是否同步云端删除分享 |
| | | memberInfo.CurResidenceShareDate.Remove(sd); |
| | | } |
| | | else |
| | | { |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | foreach (var room in SpatialInfo.CurrentSpatial.RoomList) |
| | | { |
| | | var roomView = new FrameLayout() |
| | | var roomView = new RowLayout() |
| | | { |
| | | Height = Application.GetRealWidth(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | LineColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | roomListView.AddChidren(roomView); |
| | | |
| | |
| | | addCount++; |
| | | } |
| | | } |
| | | //移除当前住宅已经不存在的功能 |
| | | for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;) |
| | | { |
| | | var sd = memberInfo.CurResidenceShareDate[i]; |
| | | if (FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.deviceId == sd.shareTypeId) == null) |
| | | { |
| | | //new DAL.Server.HttpServerRequest().DeleteShareData(sd); |
| | | memberInfo.CurResidenceShareDate.Remove(sd); |
| | | } |
| | | else |
| | | { |
| | | i++; |
| | | } |
| | | } |
| | | ////移除当前住宅已经不存在的功能 |
| | | //for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;) |
| | | //{ |
| | | // var sd = memberInfo.CurResidenceShareDate[i]; |
| | | // if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null) |
| | | // { |
| | | // //new DAL.Server.HttpServerRequest().DeleteShareData(sd); |
| | | // memberInfo.CurResidenceShareDate.Remove(sd); |
| | | // } |
| | | // else |
| | | // { |
| | | // i++; |
| | | // } |
| | | //} |
| | | |
| | | var btnFunctionCount = new Button() |
| | | { |
| | |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | roomView.AddChidren(btnRight); |
| | | //分割线 |
| | | var lineView = new LineView(roomView.Height - Application.GetRealHeight(1)); |
| | | roomView.AddChidren(lineView); |
| | | //删除按钮 |
| | | var deleteBtn = new Button() |
| | | { |
| | | TextID = StringId.Del, |
| | | BackgroundColor = CSS_Color.AuxiliaryColor2, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | roomView.AddRightView(deleteBtn); |
| | | deleteBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //删除事件 |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> eHandler = (sender, e) => |
| | | { |
| | |
| | | btnRoomName.MouseUpEventHandler = eHandler; |
| | | btnRight.MouseUpEventHandler = eHandler; |
| | | btnFunctionCount.MouseUpEventHandler = eHandler; |
| | | |
| | | if (SpatialInfo.CurrentSpatial.RoomList.IndexOf(room) < SpatialInfo.CurrentSpatial.RoomList.Count - 2) |
| | | { |
| | | var btnRoomLine = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealWidth(49), |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealWidth(1), |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }; |
| | | roomView.AddChidren(btnRoomLine); |
| | | } |
| | | } |
| | | |
| | | //if (DB_ResidenceData.rooms.Count > 10) |
| | | //{ |
| | | // roomListView.ScrollEnabled = true; |
| | | //} |
| | | //else |
| | | //{ |
| | | // roomListView.ScrollEnabled = false; |
| | | //2020-12-16 加载未分配区域功能 |
| | | AddNoAreaFunction(unallocatedList); |
| | | } |
| | | |
| | | // roomListView.AddChidren(new Button() |
| | | /// <summary> |
| | | /// 添加未分配区域功能 |
| | | /// </summary> |
| | | /// <param name="unallocatedList"></param> |
| | | void AddNoAreaFunction(List<Function> unallocatedList) |
| | | { |
| | | var roomView = new RowLayout() |
| | | { |
| | | Height = Application.GetRealWidth(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | LineColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | roomListView.AddChidren(roomView); |
| | | |
| | | var btnRoomName = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealWidth(4), |
| | | Width = Application.GetRealWidth(330), |
| | | Height = Application.GetRealWidth(24), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.NoAreaFunction |
| | | }; |
| | | roomView.AddChidren(btnRoomName); |
| | | |
| | | //计算已经加入房间的设备数量 |
| | | int addCount = 0; |
| | | foreach (var sd in memberInfo.CurResidenceShareDate) |
| | | { |
| | | if (unallocatedList.Find((obj) => obj.deviceId == sd.shareTypeId) != null) |
| | | { |
| | | addCount++; |
| | | } |
| | | } |
| | | ////移除当前住宅已经不存在的功能 |
| | | //for (int i = 0; i < memberInfo.CurResidenceShareDate.Count;) |
| | | //{ |
| | | // var sd = memberInfo.CurResidenceShareDate[i]; |
| | | // if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null) |
| | | // { |
| | | // Height = Application.GetRealWidth(441), |
| | | // BackgroundColor = CSS_Color.BackgroundColor, |
| | | // }); |
| | | // //new DAL.Server.HttpServerRequest().DeleteShareData(sd); |
| | | // memberInfo.CurResidenceShareDate.Remove(sd); |
| | | // } |
| | | // else |
| | | // { |
| | | // i++; |
| | | // } |
| | | //} |
| | | |
| | | var btnFunctionCount = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = btnRoomName.Bottom, |
| | | Width = Application.GetRealWidth(330), |
| | | Height = Application.GetRealWidth(18), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, |
| | | Text = addCount + "/" + unallocatedList.Count.ToString(), |
| | | }; |
| | | roomView.AddChidren(btnFunctionCount); |
| | | |
| | | var btnRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(351), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/Right.png", |
| | | }; |
| | | roomView.AddChidren(btnRight); |
| | | ////分割线 |
| | | //var lineView = new LineView(roomView.Height - Application.GetRealHeight(1)); |
| | | //roomView.AddChidren(lineView); |
| | | //删除按钮 |
| | | var deleteBtn = new Button() |
| | | { |
| | | TextID = StringId.Del, |
| | | BackgroundColor = CSS_Color.AuxiliaryColor2, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | roomView.AddRightView(deleteBtn); |
| | | deleteBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //删除事件 |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> eHandler = (sender, e) => |
| | | { |
| | | Action<string> refreshFunctionCount = (newCount) => { |
| | | btnFunctionCount.Text = newCount + "/" + unallocatedList.Count.ToString(); |
| | | }; |
| | | //var mmp = new MemberFunctionPermissionPage(memberInfo, room, refreshFunctionCount); |
| | | //MainPage.BasePageView.AddChidren(mmp); |
| | | //mmp.LoadPage(StringId.PermissionToUse); |
| | | //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | roomView.MouseUpEventHandler = eHandler; |
| | | btnRoomName.MouseUpEventHandler = eHandler; |
| | | btnRight.MouseUpEventHandler = eHandler; |
| | | btnFunctionCount.MouseUpEventHandler = eHandler; |
| | | |
| | | |
| | | } |
| | | } |
| | | } |