| | |
| | | using System; |
| | | using System.Collections.Generic;
|
| | | using Shared.Common; |
| | | using Shared.Phone.Device.Category; |
| | | using Shared.Phone.Device.CommonForm; |
| | | using Shared.Phone.UserCenter;
|
| | | using Shared.Phone.UserView; |
| | |
| | | public static ListRoomViewFrom Instance |
| | | { |
| | | get |
| | | { |
| | | {
|
| | | if (roomManagement == null)
|
| | | {
|
| | | //初始化左滑菜单
|
| | | roomManagement = new ListRoomViewFrom();
|
| | | CommonPage.Instance.AddLeftView(roomManagement);
|
| | | } |
| | | return roomManagement; |
| | | } |
| | | } |
| | |
| | | /// 是否可以触发点击事件--是否可以跳转主页房间 |
| | | /// </summary> |
| | | public bool CanClick = true;
|
| | | /// <summary>
|
| | | /// 是否初始化完成
|
| | | /// </summary>
|
| | | private bool isInitFinish = false;
|
| | | /// <summary> |
| | | /// 当前楼层id |
| | | /// </summary> |
| | |
| | | /// 画面显示 |
| | | /// </summary> |
| | | public void ShowForm() |
| | | { |
| | | roomManagement = this;
|
| | | {
|
| | | //初始化头部信息 |
| | | this.InitTopFrame(); |
| | | //初始化中部控件 |
| | | this.InitBodyFrameLayout(); |
| | | |
| | | //设置头部信息 |
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.RoomList)); |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | |
| | | private void InitTopFrame()
|
| | | {
|
| | | //初始化头部控件
|
| | | this.InitTopFrameLayout(); |
| | | this.InitTopFrameLayout();
|
| | |
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.RoomList)); |
| | | |
| | | //重置返回按键的事件 |
| | | var btnBack = this.GetBackButton(); |
| | | btnBack.ButtonClickEvent = null; |
| | |
| | | };
|
| | |
|
| | | //获取楼层
|
| | | this.curFloorId = Config.Instance.Home.CurrentFloorId;
|
| | |
|
| | | var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
|
| | | if (dicFloor.Count == 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | this.curFloorId = Config.Instance.Home.CurrentFloorId;
|
| | | //楼层图标
|
| | | var btnIconContr = new MostRightIconControl(69, 69);
|
| | | btnIconContr.UnSelectedImagePath = "Item/Drop_Down.png";
|
| | |
| | | btnIconContr.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //楼层菜单
|
| | | var floors = new SelectFloor();
|
| | | var floors = new Category.SelectFloorForm();
|
| | | AddChidren(floors);
|
| | | floors.changeFloor = false;
|
| | | floors.CurFloorId = curFloorId;
|
| | |
| | | {
|
| | | this.curFloorId = floorId;
|
| | | btnFloor.Text = dicFloor[floorId];
|
| | | //刷新房间列表
|
| | | this.RefreshListRoom();
|
| | | //刷新Body容器
|
| | | this.RefreshBodyFrame();
|
| | | };
|
| | | };
|
| | | } |
| | |
| | | listView.Height = bodyFrameLayout.Height; |
| | | listView.Width = bodyFrameLayout.Width; |
| | | bodyFrameLayout.AddChidren(listView); |
| | | //刷新房间列表 |
| | | this.RefreshListRoom(); |
| | | //刷新Body容器
|
| | | this.RefreshBodyFrame(); |
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | /// </summary>
|
| | | public void RefreshListRoom()
|
| | | {
|
| | | //如果还没有初始化完成界面的话
|
| | | if (this.isInitFinish == false)
|
| | | {
|
| | | this.ShowForm();
|
| | | this.isInitFinish = true;
|
| | | return;
|
| | | }
|
| | | //把头部也一起初始化了
|
| | | this.topFrameLayout.RemoveAll();
|
| | | //初始化头部信息
|
| | | this.InitTopFrame();
|
| | |
|
| | | //刷新Body容器
|
| | | this.RefreshBodyFrame();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 刷新Body容器
|
| | | /// </summary>
|
| | | private void RefreshBodyFrame()
|
| | | {
|
| | | //先清空
|
| | | this.listView.frameTable.RemoveAll();
|
| | | this.listView.frameTable.Height = Application.GetRealHeight(100);
|
| | |
| | | listRoom.Insert(0, HdlRoomLogic.Current.GetLoveRoom());
|
| | |
|
| | | //X轴
|
| | | int XX = Application.GetRealWidth(43);
|
| | | int XX = this.GetPictrueRealSize(43);
|
| | | //Y轴
|
| | | int YY = Application.GetRealWidth(58);
|
| | | int YY = this.GetPictrueRealSize(58);
|
| | | //房间计数
|
| | | int roomCount = 0;
|
| | | foreach (var room in listRoom)
|
| | |
| | | //加缓存
|
| | | this.dicCardControl[room.Id] = contr;
|
| | | //每两个重置X轴
|
| | | XX = roomCount % 2 == 0 ? Application.GetRealWidth(43) : contr.Right + Application.GetRealWidth(3);
|
| | | XX = roomCount % 2 == 0 ? this.GetPictrueRealSize(43) : contr.Right + this.GetPictrueRealSize(3);
|
| | | //每两个累加Y轴
|
| | | if (roomCount >= 2 && roomCount % 2 == 0)
|
| | | {
|
| | | YY = contr.Bottom + Application.GetRealHeight(14);
|
| | | YY = contr.Bottom + this.GetPictrueRealSize(14);
|
| | | }
|
| | | contr.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | |
| | | }
|
| | | string oldFloorId = Config.Instance.Home.CurrentFloorId;
|
| | | CommonPage.Instance.CloseLeftMenu();
|
| | | HdlRoomLogic.Current.CurrentRoom = room;
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | |
| | | if (oldFloorId != room.FloorId)
|
| | | {
|
| | | //楼层都切换的话,刷新整个主页
|
| | | UserPage.Instance.Fresh();
|
| | | UserPage.Instance.ReFreshControl();
|
| | | return;
|
| | | }
|
| | | }
|
| | | //如果只是切换当前楼层的其他房间,则只滑动主页的滑动控件
|
| | | this.LoadFormMethodByName("HomeMainPageForm", "SetRoomPageViewSelect", room);
|
| | | HomeMainPageForm.Instance?.SetRoomPageViewSelect(room);
|
| | | });
|
| | | });
|
| | | };
|
| | | }
|
| | | //初始化未分配卡片
|
| | | this.InitRoomCardControl(XX, YY);
|
| | | //成员是没有未分配这个东西出来的
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | {
|
| | | //初始化未分配卡片
|
| | | this.InitRoomCardControl(XX, YY);
|
| | | }
|
| | | //调整桌布高度
|
| | | this.listView.AdjustTableHeight();
|
| | | }
|
| | |
| | | private void InitRoomCardControl(int XX, int YY)
|
| | | {
|
| | | //桌布控件
|
| | | var frameBack = new FrameLayoutControl();
|
| | | var frameBack = new FrameLayoutStatuControl();
|
| | | frameBack.X = XX;
|
| | | frameBack.Y = YY;
|
| | | frameBack.Width = Application.GetRealWidth(495);
|
| | | frameBack.Height = Application.GetRealHeight(354);
|
| | | frameBack.Width = this.GetPictrueRealSize(495);
|
| | | frameBack.Height = this.GetPictrueRealSize(354);
|
| | | listView.frameTable.AddChidren(frameBack);
|
| | |
|
| | | //底部阴影效果
|
| | |
| | | frameBack.AddChidren(btnShadow, ChidrenBindMode.NotBind);
|
| | |
|
| | | //背景控件
|
| | | var picBackGroud = new NormalViewControl(467, 311, true);
|
| | | var picBackGroud = new NormalViewControl(this.GetPictrueRealSize(467), this.GetPictrueRealSize(311), false);
|
| | | picBackGroud.Gravity = Gravity.CenterHorizontal;
|
| | | picBackGroud.Radius = (uint)Application.GetRealHeight(29);
|
| | | picBackGroud.Radius = (uint)this.GetPictrueRealSize(29);
|
| | | picBackGroud.BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor3;
|
| | | frameBack.AddChidren(picBackGroud, ChidrenBindMode.BindEventOnly);
|
| | | frameBack.AddChidren(picBackGroud, ChidrenBindMode.BindEvent);
|
| | |
|
| | | //未分配图标
|
| | | var btnIcon = new PicViewControl(92, 72);
|
| | | btnIcon.X = Application.GetRealWidth(129);
|
| | | btnIcon.Y = Application.GetRealHeight(141);
|
| | | btnIcon.X = this.GetPictrueRealSize(129);
|
| | | btnIcon.Y = this.GetPictrueRealSize(141);
|
| | | btnIcon.UnSelectedImagePath = "Room/NoNameRoom.png";
|
| | | frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
|
| | | frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEvent);
|
| | |
|
| | | //未分配
|
| | | var btnName = new NormalViewControl(141, 84, true);
|
| | | btnName.X = Application.GetRealWidth(244);
|
| | | btnName.Y = Application.GetRealHeight(131);
|
| | | btnName.X = this.GetPictrueRealSize(244);
|
| | | btnName.Y = this.GetPictrueRealSize(131);
|
| | | btnName.IsBold = true;
|
| | | btnName.TextColor = UserCenterColor.Current.White;
|
| | | btnName.TextID = R.MyInternationalizationString.Unallocated;
|
| | | frameBack.AddChidren(btnName, ChidrenBindMode.BindEventOnly);
|
| | | frameBack.AddChidren(btnName, ChidrenBindMode.BindEvent);
|
| | | frameBack.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (this.CanClick == false)
|