From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期五, 10 七月 2020 10:52:13 +0800 Subject: [PATCH] 2020-07-10-01 --- ZigbeeApp/Shared/Phone/MainPage/ListRoomViewFrom.cs | 104 ++++++++++++++++++++++++++++++++++----------------- 1 files changed, 69 insertions(+), 35 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/MainPage/ListRoomViewFrom.cs b/ZigbeeApp/Shared/Phone/MainPage/ListRoomViewFrom.cs index f5d841a..3b2d07d 100755 --- a/ZigbeeApp/Shared/Phone/MainPage/ListRoomViewFrom.cs +++ b/ZigbeeApp/Shared/Phone/MainPage/ListRoomViewFrom.cs @@ -1,7 +1,6 @@ 锘縰sing 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; @@ -22,7 +21,13 @@ public static ListRoomViewFrom Instance { get - { + { + if (roomManagement == null) + { + //鍒濆鍖栧乏婊戣彍鍗� + roomManagement = new ListRoomViewFrom(); + CommonPage.Instance.AddLeftView(roomManagement); + } return roomManagement; } } @@ -31,6 +36,10 @@ /// 鏄惁鍙互瑙﹀彂鐐瑰嚮浜嬩欢--鏄惁鍙互璺宠浆涓婚〉鎴块棿 /// </summary> public bool CanClick = true; + /// <summary> + /// 鏄惁鍒濆鍖栧畬鎴� + /// </summary> + private bool isInitFinish = false; /// <summary> /// 褰撳墠妤煎眰id /// </summary> @@ -52,15 +61,11 @@ /// 鐢婚潰鏄剧ず /// </summary> public void ShowForm() - { - roomManagement = this; + { //鍒濆鍖栧ご閮ㄤ俊鎭� this.InitTopFrame(); //鍒濆鍖栦腑閮ㄦ帶浠� this.InitBodyFrameLayout(); - - //璁剧疆澶撮儴淇℃伅 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.RoomList)); //鍒濆鍖栦腑閮ㄤ俊鎭� this.InitMiddleFrame(); @@ -72,7 +77,11 @@ private void InitTopFrame() { //鍒濆鍖栧ご閮ㄦ帶浠� - this.InitTopFrameLayout(); + this.InitTopFrameLayout(); + + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.RoomList)); + //閲嶇疆杩斿洖鎸夐敭鐨勪簨浠� var btnBack = this.GetBackButton(); btnBack.ButtonClickEvent = null; @@ -83,12 +92,13 @@ }; //鑾峰彇妤煎眰 + 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"; @@ -105,7 +115,7 @@ btnIconContr.ButtonClickEvent += (sender, e) => { //妤煎眰鑿滃崟 - var floors = new SelectFloor(); + var floors = new Category.SelectFloorForm(); AddChidren(floors); floors.changeFloor = false; floors.CurFloorId = curFloorId; @@ -114,8 +124,8 @@ { this.curFloorId = floorId; btnFloor.Text = dicFloor[floorId]; - //鍒锋柊鎴块棿鍒楄〃 - this.RefreshListRoom(); + //鍒锋柊Body瀹瑰櫒 + this.RefreshBodyFrame(); }; }; } @@ -129,8 +139,8 @@ listView.Height = bodyFrameLayout.Height; listView.Width = bodyFrameLayout.Width; bodyFrameLayout.AddChidren(listView); - //鍒锋柊鎴块棿鍒楄〃 - this.RefreshListRoom(); + //鍒锋柊Body瀹瑰櫒 + this.RefreshBodyFrame(); } #endregion @@ -142,6 +152,27 @@ /// </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); @@ -152,9 +183,9 @@ 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) @@ -169,11 +200,11 @@ //鍔犵紦瀛� this.dicCardControl[room.Id] = contr; //姣忎袱涓噸缃甔杞� - XX = roomCount % 2 == 0 ? Application.GetRealWidth(43) : contr.Right + Application.GetRealWidth(3); + XX = roomCount % 2 == 0 ? this.GetPictrueRealSize(43) : contr.Right + this.GetPictrueRealSize(3); //姣忎袱涓疮鍔燳杞� if (roomCount >= 2 && roomCount % 2 == 0) { - YY = contr.Bottom + Application.GetRealHeight(14); + YY = contr.Bottom + this.GetPictrueRealSize(14); } contr.ButtonClickEvent += (sender, e) => { @@ -183,7 +214,6 @@ } string oldFloorId = Config.Instance.Home.CurrentFloorId; CommonPage.Instance.CloseLeftMenu(); - HdlRoomLogic.Current.CurrentRoom = room; HdlThreadLogic.Current.RunThread(() => { @@ -198,18 +228,22 @@ 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(); } @@ -220,11 +254,11 @@ 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); //搴曢儴闃村奖鏁堟灉 @@ -233,27 +267,27 @@ 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) -- Gitblit v1.8.0