| | |
| | | /// 功能显示区域 |
| | | /// </summary> |
| | | VerticalScrolViewLayout contentView; |
| | | /// <summary> |
| | | /// 底部操作按钮 |
| | | /// </summary> |
| | | Button btnOption; |
| | | /// <summary> |
| | | /// 页面标题ID |
| | | /// </summary> |
| | | int titleId; |
| | | |
| | | ResidenceMemberInfo memberInfo; |
| | | |
| | | Room room; |
| | | /// <summary> |
| | | /// 当前的房间roomId |
| | | /// 如果为空,则代表管理无分配区域的功能分享 |
| | | /// </summary> |
| | | string roomId; |
| | | /// <summary> |
| | | /// 房间所有功能和场景列表 |
| | | /// </summary> |
| | | List<RoomData> roomFunctionOrSceneList = new List<RoomData>(); |
| | | |
| | | |
| | | List<Function> funs; |
| | | /// <summary> |
| | | /// 刷新回调Action |
| | | /// </summary> |
| | | Action refreshAction; |
| | | /// <summary> |
| | | /// 当前账号的所有分享列表 |
| | | /// </summary> |
| | | List<ShareData> curResidenceShareData; |
| | | /// <summary> |
| | | /// 属于当前房间最终的设备分享列表 |
| | | /// </summary> |
| | | List<ShareData> funs_RoomAll; |
| | | //shareDataList = new List<ShareData>(); |
| | | /// <summary> |
| | | /// 删除的分享列表 |
| | | /// </summary> |
| | | List<ShareData> funs_Del; |
| | | |
| | | public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, Room r) |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="mInfo"></param> |
| | | /// <param name="roomFunctionOrSceneList">房间所有功能和场景列表</param> |
| | | /// <param name="roomId"></param> |
| | | /// <param name="refreshAction"></param> |
| | | public MemberFunctionPermissionPage(ResidenceMemberInfo mInfo, List<RoomData> roomFunctionOrSceneList, List<ShareData> funs_RoomAll, string roomId, Action refreshAction) |
| | | { |
| | | 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)); |
| | | } |
| | | this.memberInfo = mInfo; |
| | | this.roomFunctionOrSceneList = roomFunctionOrSceneList; |
| | | this.roomId = roomId; |
| | | //this.curResidenceShareData = new List<ShareData>(); |
| | | this.curResidenceShareData = memberInfo.CurResidenceShareData; |
| | | this.funs_RoomAll = new List<ShareData>(); |
| | | this.funs_RoomAll.AddRange(funs_RoomAll); |
| | | this.funs_Del = new List<ShareData>(); |
| | | this.refreshAction = refreshAction; |
| | | } |
| | | |
| | | public void LoadPage() |
| | | public void LoadPage(int tId) |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.PermissionToUse)).LoadTopView(); |
| | | titleId = tId; |
| | | new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(); |
| | | |
| | | allRoomView = new FrameLayout() |
| | | { |
| | |
| | | { |
| | | 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, |
| | |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | var btnOption = new Button() |
| | | btnOption = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(519+64), |
| | | Y = Application.GetRealHeight(519 + 64), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(44), |
| | | Height = Application.GetRealWidth(44), |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextID = StringId.Confirm, |
| | | TextID = titleId == StringId.MemberPermissionManagement ? StringId.Confirm : StringId.Shared, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | IsBold = true, |
| | | Radius = (uint) Application.GetRealWidth(22), |
| | | 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(); |
| | | }; |
| | | LoadFunctionRow(); |
| | | |
| | | LoadFunctionRow(funs_RoomAll); |
| | | |
| | | LoadEventList(); |
| | | } |
| | | /// <summary> |
| | | /// 加载功能列表 |
| | | /// </summary> |
| | | void LoadFunctionRow() |
| | | void LoadFunctionRow(List<ShareData> shareDatas) |
| | | { |
| | | contentView.RemoveAll(); |
| | | foreach (var function in room.functions) |
| | | foreach (var roomData in roomFunctionOrSceneList) |
| | | { |
| | | var roomView = new FrameLayout() |
| | | { |
| | |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = function.name, |
| | | Text = roomData.name, |
| | | }; |
| | | roomView.AddChidren(btnRoomText); |
| | | |
| | |
| | | Tag = "ChooseIcon" |
| | | }; |
| | | roomView.AddChidren(btnChoose); |
| | | if (funs.Find((obj) => obj.sid == function.sid) != null) |
| | | |
| | | var shareData = shareDatas.Find((obj) => obj.shareTypeId == roomData.shareTypeId); |
| | | if (shareData != null) |
| | | { |
| | | btnChoose.IsSelected = true; |
| | | funs.Add(function); |
| | | //刷新属于当前房间的分享统计 |
| | | //funs_New.Add(shareData); |
| | | } |
| | | else |
| | | { |
| | | if (btnChooseAll.IsSelected) |
| | | btnChooseAll.IsSelected = false; |
| | | } |
| | | LoadEvent_SharedDataChange(btnChoose, btnRoomText, roomView, function); |
| | | LoadMethod_SharedDataChange(btnChoose, btnRoomText, roomView, roomData); |
| | | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | 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(); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 房间所有功能和者场景列表 |
| | | /// </summary> |
| | | public class RoomData |
| | | { |
| | | /// <summary> |
| | | /// 设备名字或者场景名字 |
| | | /// </summary> |
| | | public string shareTypeId; |
| | | /// <summary> |
| | | /// 设备名字或者场景名字 |
| | | /// </summary> |
| | | public string name; |
| | | /// <summary> |
| | | /// 分享类型 1.ROOM 2.DEVICE 3.SCENE |
| | | /// </summary> |
| | | public string shareType = ShareType.DEVICE.ToString(); |
| | | } |
| | | } |