old mode 100755
new mode 100644
| | |
| | | } |
| | | } |
| | | |
| | | //移除当前住宅已经不存在的功能 |
| | | for (int i = 0; i < memberInfo.CurResidenceShareData.Count;) |
| | | //所有场景 |
| | | List<Scene> allSceneList = FunctionList.List.scenes; |
| | | //全局场景场景 |
| | | List<Scene> globalSceneList = new List<Scene>(); |
| | | //找出所有的全局场景 |
| | | foreach (var mScene in allSceneList) |
| | | { |
| | | var sd = memberInfo.CurResidenceShareData[i]; |
| | | if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null) |
| | | |
| | | //roomIds大于0 代表分配到房间 |
| | | mScene.roomIds.Remove(null); |
| | | if (mScene.roomIds.Count > 0) |
| | | { |
| | | //new DAL.Server.HttpServerRequest().DeleteShareData(sd); |
| | | //待确认是否同步云端删除分享 |
| | | memberInfo.CurResidenceShareData.Remove(sd); |
| | | //allocatedList.Add(function); |
| | | } |
| | | else |
| | | { |
| | | i++; |
| | | globalSceneList.Add(mScene); |
| | | } |
| | | } |
| | | |
| | | ////移除当前住宅已经不存在的功能 |
| | | //for (int i = 0; i < memberInfo.CurResidenceShareData.Count;) |
| | | //{ |
| | | // var sd = memberInfo.CurResidenceShareData[i]; |
| | | // if (allFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) == null) |
| | | // { |
| | | // //new DAL.Server.HttpServerRequest().DeleteShareData(sd); |
| | | // //待确认是否同步云端删除分享 |
| | | // memberInfo.CurResidenceShareData.Remove(sd); |
| | | // } |
| | | // else |
| | | // { |
| | | // i++; |
| | | // } |
| | | //} |
| | | |
| | | try |
| | | { |
| | |
| | | AddRoomFunctionRowLayout(room); |
| | | } |
| | | //2020-12-16 加载未分配区域功能RowLayout |
| | | AddNoAreaFunctionRowLayout(unallocatedList); |
| | | AddNoAreaFunctionRowLayout(unallocatedList, globalSceneList); |
| | | } |
| | | catch |
| | | { |
| | |
| | | /// <param name="mRoom"></param> |
| | | void AddRoomFunctionRowLayout(Room mRoom) |
| | | { |
| | | ShowBaseRoomFunOrNoAreaFunRowLayout(mRoom, null); |
| | | ShowBaseRoomFunOrNoAreaFunRowLayout(mRoom, null, null); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加未分配区域功能 的个数统计状态的RowLayout |
| | | /// |
| | | /// </summary> |
| | | /// <param name="unallocatedList">未分配的所有功能列表</param> |
| | | void AddNoAreaFunctionRowLayout(List<Function> unallocatedList) |
| | | /// <param name="globalSceneList">全区域的场景</param> |
| | | void AddNoAreaFunctionRowLayout(List<Function> unallocatedList, List<Scene> globalSceneList) |
| | | { |
| | | ShowBaseRoomFunOrNoAreaFunRowLayout(null, unallocatedList); |
| | | ShowBaseRoomFunOrNoAreaFunRowLayout(null, unallocatedList, globalSceneList); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="room">如果房间为空,代表管理无分配区域</param> |
| | | /// <param name="unallocatedList">管理无分配区域才有效</param> |
| | | void ShowBaseRoomFunOrNoAreaFunRowLayout(Room mRoom, List<Function> unallocatedList) |
| | | /// <param name="globalSceneList">全局场景</param> |
| | | void ShowBaseRoomFunOrNoAreaFunRowLayout(Room mRoom, List<Function> unallocatedList, List<Scene> globalSceneList) |
| | | { |
| | | /// 当前房间或者无分配区域分享列表 |
| | | List<ShareData> funs_RoomAll = new List<ShareData>(); |
| | | /// <summary> |
| | | /// 房间或者无分配区域所有功能列表 |
| | | /// </summary> |
| | | List<Function> roomFunctionList = new List<Function>(); |
| | | |
| | | /// 房间所有功能和者场景列表 |
| | | List<RoomData> roomFunctionOrSceneList = new List<RoomData>(); |
| | | |
| | | /// 房间ID |
| | | string roomId = ""; |
| | | |
| | |
| | | { |
| | | //显示房间名 |
| | | btnRoomName.Text = mRoom.roomName; |
| | | roomFunctionList = mRoom.GetRoomFunctions(false); |
| | | var mRoomFunctionList = mRoom.GetRoomFunctions(false); |
| | | var mRoomSceneList = mRoom.GetRoomScenes(false); |
| | | //遍历所有功能列表 |
| | | if (mRoomFunctionList != null) |
| | | { |
| | | foreach (var fun in mRoomFunctionList) |
| | | { |
| | | roomFunctionOrSceneList.Add(new RoomData() |
| | | { |
| | | shareTypeId = fun.deviceId, |
| | | shareType = ShareType.DEVICE.ToString(), |
| | | name = fun.name, |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //遍历所有场景列表 |
| | | if (mRoomSceneList != null) |
| | | { |
| | | foreach (var roomScene in mRoomSceneList) |
| | | { |
| | | roomFunctionOrSceneList.Add(new RoomData() |
| | | { |
| | | shareTypeId = roomScene.userSceneId, |
| | | shareType = ShareType.SCENE.ToString(), |
| | | name = roomScene.name, |
| | | }); |
| | | } |
| | | } |
| | | |
| | | roomId = mRoom.roomId; |
| | | //添加分割线 |
| | | var lineView = new LineView(roomView.Height - Application.GetRealHeight(1)); |
| | |
| | | { |
| | | //显示无区域功能 |
| | | btnRoomName.TextID = StringId.NoAreaFunction; |
| | | roomFunctionList = unallocatedList; |
| | | roomId = null; |
| | | |
| | | //遍历所有功能列表 |
| | | if (unallocatedList != null) |
| | | { |
| | | foreach (var fun in unallocatedList) |
| | | { |
| | | roomFunctionOrSceneList.Add(new RoomData() |
| | | { |
| | | shareTypeId = fun.deviceId, |
| | | shareType = ShareType.DEVICE.ToString(), |
| | | name = fun.name, |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //遍历所有场景列表 |
| | | if (globalSceneList != null) |
| | | { |
| | | foreach (var roomScene in globalSceneList) |
| | | { |
| | | roomFunctionOrSceneList.Add(new RoomData() |
| | | { |
| | | shareTypeId = roomScene.userSceneId, |
| | | shareType = ShareType.SCENE.ToString(), |
| | | name = roomScene.name, |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //删除按钮 |
| | |
| | | deleteBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //一键删除所有分享 |
| | | DeleteRoomAllShare(funs_RoomAll, roomFunctionList, roomId, btnFunctionCount, roomView); |
| | | DeleteRoomAllShare(funs_RoomAll, roomFunctionOrSceneList, roomId, btnFunctionCount, roomView); |
| | | }; |
| | | |
| | | //计算已经加入房间的设备数量的Action事件 |
| | |
| | | int addCount = 0; |
| | | foreach (var sd in memberInfo.CurResidenceShareData) |
| | | { |
| | | if (roomFunctionList.Find((obj) => obj.deviceId == sd.shareTypeId) != null) |
| | | if (roomFunctionOrSceneList.Find((obj) => obj.shareTypeId == sd.shareTypeId) != null) |
| | | { |
| | | addCount++; |
| | | funs_RoomAll.Add(sd); |
| | | } |
| | | } |
| | | btnFunctionCount.Text = addCount + "/" + roomFunctionList.Count.ToString(); |
| | | btnFunctionCount.Text = addCount + "/" + roomFunctionOrSceneList.Count.ToString(); |
| | | //Utlis.WriteLine("刷新成功"); |
| | | }; |
| | | //点击调整事件 |
| | | EventHandler<MouseEventArgs> eHandler = (sender, e) => |
| | | { |
| | | var mmp = new MemberFunctionPermissionPage(memberInfo, roomFunctionList, funs_RoomAll, roomId, RefreshAction); |
| | | var mmp = new MemberFunctionPermissionPage(memberInfo, roomFunctionOrSceneList, funs_RoomAll, roomId, RefreshAction); |
| | | MainPage.BasePageView.AddChidren(mmp); |
| | | mmp.LoadPage(StringId.MemberPermissionManagement); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |