From f14dcfd967404e197e7ec995ca8d6f2b090d3b7d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 11 九月 2020 09:16:59 +0800
Subject: [PATCH] 优化多功能面板:绑定温湿度传感器目标,和设备列表回路显示。优化数据矫正功能温湿度度不设置的情况。优化门锁时间设置最后一天和最后最后一个月的时间显示等 细节

---
 ZigbeeApp/Shared/Phone/MainPage/LeftListRoomViewFrom.cs |  359 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 359 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/LeftListRoomViewFrom.cs b/ZigbeeApp/Shared/Phone/MainPage/LeftListRoomViewFrom.cs
new file mode 100755
index 0000000..7efcb76
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/MainPage/LeftListRoomViewFrom.cs
@@ -0,0 +1,359 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Shared.Common;
+using Shared.Phone.Device.CommonForm;
+using Shared.Phone.UserCenter;
+using Shared.Phone.UserView;
+
+namespace Shared.Phone.MainPage
+{
+    /// <summary>
+    /// 宸︽粦鑿滃崟鐨勭殑鎴块棿鍒楄〃鐣岄潰
+    /// </summary>
+    public class LeftListRoomViewFrom : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        private static LeftListRoomViewFrom roomManagement = null;
+        /// <summary>
+        /// 宸︽粦鑿滃崟鐨勭殑鎴块棿瀵硅薄
+        /// </summary>
+        public static LeftListRoomViewFrom Instance
+        {
+            get
+            {
+                if (roomManagement == null)
+                {
+                    //鍒濆鍖栧乏婊戣彍鍗�
+                    roomManagement = new LeftListRoomViewFrom();
+                    CommonPage.Instance.AddLeftView(roomManagement);
+                }
+                return roomManagement;
+            }
+        }
+
+        /// <summary>
+        /// 鏄惁鍙互瑙﹀彂鐐瑰嚮浜嬩欢--鏄惁鍙互璺宠浆涓婚〉鎴块棿
+        /// </summary>
+        public bool CanClick = true;
+        /// <summary>
+        /// 鏄惁鍒濆鍖栧畬鎴�
+        /// </summary>
+        private bool isInitFinish = false;
+        /// <summary>
+        /// 褰撳墠妤煎眰id
+        /// </summary>
+        private string curFloorId = string.Empty;
+        /// <summary>
+        /// 鍒楄〃鎺т欢
+        /// </summary>
+        private VerticalFrameControl listView = null;
+        /// <summary>
+        /// 鍗$墖鎺т欢闆嗗悎
+        /// </summary>
+        private Dictionary<string, Controls.ListRoomCardControl> dicCardControl = new Dictionary<string, Controls.ListRoomCardControl>();
+        /// <summary>
+        /// 鏈垎閰嶇晫闈�(鐢ㄤ簬瀵瑰簲鍒汉涔辨悶,鍦ㄦ墦寮�鏈垎閰嶇晫闈笉鍏虫椂,鍘诲埛鏂板満鏅�,鐒跺悗鎻恇ug璇存病鏈夊満鏅�)
+        /// </summary>
+        private UnallocatedRoomForm unalloctedRoom = null;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず
+        /// </summary>
+        private void ShowForm()
+        {
+            //鍒濆鍖栧ご閮ㄤ俊鎭�
+            this.InitTopFrame();
+            //鍒濆鍖栦腑閮ㄦ帶浠�
+            this.InitBodyFrameLayout();
+
+            //鍒濆鍖栦腑閮ㄤ俊鎭�
+            this.InitMiddleFrame();
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栧ご閮ㄤ俊鎭�
+        /// </summary>
+        private void InitTopFrame()
+        {
+            //鍒濆鍖栧ご閮ㄦ帶浠�
+            this.InitTopFrameLayout();
+
+            //璁剧疆澶撮儴淇℃伅
+            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.RoomList));
+
+            //閲嶇疆杩斿洖鎸夐敭鐨勪簨浠�
+            var btnBack = this.GetBackButton();
+            btnBack.ButtonClickEvent = null;
+            btnBack.ButtonClickEvent += (sender, e) =>
+            {
+                //鏀惰捣宸﹁彍鍗�
+                CommonPage.Instance.CloseLeftMenu();
+            };
+
+            //鑾峰彇妤煎眰
+            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
+            if (dicFloor.Count == 0)
+            {
+                return;
+            }
+            //妤煎眰鍒濆ID
+            foreach (var floorId in dicFloor.Keys)
+            {
+                this.curFloorId = floorId;
+                break;
+            }
+
+            //妤煎眰鍥炬爣
+            var btnIconContr = new MostRightIconControl(69, 69);
+            btnIconContr.UnSelectedImagePath = "Item/Drop_Down.png";
+            topFrameLayout.AddChidren(btnIconContr);
+            btnIconContr.InitControl();
+            //妤煎眰鍚�
+            var btnFloor = new NormalViewControl(200, 69, true);
+            btnFloor.Gravity = Gravity.CenterVertical;
+            btnFloor.X = btnIconContr.X + btnIconContr.btnIcon.X - Application.GetRealWidth(200);
+            btnFloor.TextAlignment = TextAlignment.CenterRight;
+            btnFloor.Text = HdlResidenceLogic.Current.GetFloorNameById(this.curFloorId);
+            topFrameLayout.AddChidren(btnFloor);
+
+            btnIconContr.ButtonClickEvent += (sender, e) =>
+            {
+                //妤煎眰鑿滃崟
+                var floors = new Category.SelectFloorForm();
+                floors.CurFloorId = this.curFloorId;
+                AddChidren(floors);
+                floors.CurFloorId = this.curFloorId;
+                floors.Init(599, 161, Direction.Right);
+                floors.FloorAction += (floorId) =>
+                {
+                    this.curFloorId = floorId;
+                    btnFloor.Text = dicFloor[floorId];
+                    //鍒锋柊Body瀹瑰櫒
+                    this.RefreshBodyFrame();
+                };
+            };
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        /// </summary>
+        private void InitMiddleFrame()
+        {
+            this.listView = new VerticalFrameControl();
+            listView.Height = bodyFrameLayout.Height;
+            listView.Width = bodyFrameLayout.Width;
+            bodyFrameLayout.AddChidren(listView);
+            //鍒锋柊Body瀹瑰櫒
+            this.RefreshBodyFrame();
+        }
+
+        #endregion
+
+        #region 鈻� 鍒锋柊鎴块棿鍒楄〃_______________________
+
+        /// <summary>
+        /// 鍒锋柊鎴块棿鍒楄〃
+        /// </summary>
+        public void RefreshListRoom()
+        {
+            if (Config.Instance.Home.FloorDics.Count == 0)
+            {
+                //鏉ュ洖鍒囨崲澶囦唤,浼氬嚭鐜伴棶棰�,妤煎眰id娌℃竻闄�
+                this.curFloorId = string.Empty;
+            }
+            //淇濋櫓璧疯,杩欓噷瑕佸叧闂湭鍒嗛厤鐣岄潰
+            this.CloseUnallocatedRoomForm();
+
+            //濡傛灉杩樻病鏈夊垵濮嬪寲瀹屾垚鐣岄潰鐨勮瘽
+            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);
+            this.dicCardControl.Clear();
+
+            var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(curFloorId);
+            //杩藉姞鎴戠殑鍠滅埍
+            listRoom.Insert(0, HdlRoomLogic.Current.GetLoveRoom());
+
+            //X杞�
+            int XX = this.GetPictrueRealSize(43);
+            //Y杞�
+            int YY = this.GetPictrueRealSize(58);
+            //鎴块棿璁℃暟
+            int roomCount = 0;
+            foreach (var room in listRoom)
+            {
+                roomCount++;
+                //鍒濆鍖栧崱鐗囨帶浠�
+                var contr = new Controls.ListRoomCardControl();
+                contr.X = XX;
+                contr.Y = YY;
+                listView.frameTable.AddChidren(contr);
+                contr.InitControl(room);
+                //鍔犵紦瀛�
+                this.dicCardControl[room.Id] = contr;
+                //姣忎袱涓噸缃甔杞�
+                XX = roomCount % 2 == 0 ? this.GetPictrueRealSize(43) : contr.Right + this.GetPictrueRealSize(3);
+                //姣忎袱涓疮鍔燳杞�
+                if (roomCount >= 2 && roomCount % 2 == 0)
+                {
+                    YY = contr.Bottom + this.GetPictrueRealSize(14);
+                }
+                contr.ButtonClickEvent += (sender, e) =>
+                {
+                    if (CanClick == false)
+                    {
+                        return;
+                    }
+                    CommonPage.Instance.CloseLeftMenu();
+
+                    HdlThreadLogic.Current.RunThread(() =>
+                    {
+                        //绛夊緟鎺т欢鍚戝乏绉诲姩缁撴潫
+                        System.Threading.Thread.Sleep(300);
+                        HdlThreadLogic.Current.RunMain(() =>
+                        {
+                            //鐐瑰嚮鐨勬槸鏀惰棌鎴块棿鐨勮瘽,涓嶅彉鏇村綋鍓嶆ゼ灞俰d
+                            if (room.FloorId != string.Empty)
+                            {
+                                if (Config.Instance.Home.CurrentFloorId != room.FloorId)
+                                {
+                                    //妤煎眰閮藉垏鎹㈢殑璇�,鍒锋柊鏁翠釜涓婚〉
+                                    Config.Instance.Home.CurrentFloorId = room.FloorId;
+                                    HdlRoomLogic.Current.NowMainPageRoom = room;
+                                    UserPage.Instance.ReFreshControl();
+                                    return;
+                                }
+                            }
+                            //濡傛灉鍙槸鍒囨崲褰撳墠妤煎眰鐨勫叾浠栨埧闂�,鍒欏彧婊戝姩涓婚〉鐨勬粦鍔ㄦ帶浠�
+                            HomeMainPageForm.Instance?.SetRoomPageViewSelect(room);
+                        });
+                    });
+                };
+            }
+            //鎴愬憳鏄病鏈夋湭鍒嗛厤杩欎釜涓滆タ鍑烘潵鐨�
+            if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
+            {
+                //鍒濆鍖栨湭鍒嗛厤鍗$墖
+                this.InitRoomCardControl(XX, YY);
+            }
+            //璋冩暣妗屽竷楂樺害
+            this.listView.AdjustTableHeight();
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栨湭鍒嗛厤鍗$墖
+        /// </summary>
+        private void InitRoomCardControl(int XX, int YY)
+        {
+            //妗屽竷鎺т欢
+            var frameBack = new FrameLayoutStatuControl();
+            frameBack.X = XX;
+            frameBack.Y = YY;
+            frameBack.Width = this.GetPictrueRealSize(495);
+            frameBack.Height = this.GetPictrueRealSize(354);
+            listView.frameTable.AddChidren(frameBack);
+
+            //搴曢儴闃村奖鏁堟灉
+            var btnShadow = new NormalViewControl(frameBack.Width, frameBack.Height, false);
+            btnShadow.UnSelectedImagePath = "Room/RoomCardView.png";
+            frameBack.AddChidren(btnShadow, ChidrenBindMode.NotBind);
+
+            //鑳屾櫙鎺т欢
+            var picBackGroud = new NormalViewControl(this.GetPictrueRealSize(467), this.GetPictrueRealSize(311), false);
+            picBackGroud.Gravity = Gravity.CenterHorizontal;
+            picBackGroud.Radius = (uint)this.GetPictrueRealSize(29);
+            picBackGroud.BackgroundColor = ZigbeeColor.Current.GXCBlackBackgroundColor3;
+            frameBack.AddChidren(picBackGroud, ChidrenBindMode.BindEvent);
+
+            //鏈垎閰嶅浘鏍�
+            var btnIcon = new PicViewControl(92, 72);
+            btnIcon.X = this.GetPictrueRealSize(129);
+            btnIcon.Y = this.GetPictrueRealSize(141);
+            btnIcon.UnSelectedImagePath = "Room/NoNameRoom.png";
+            frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEvent);
+
+            //鏈垎閰�
+            var btnName = new NormalViewControl(141, 84, true);
+            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.BindEvent);
+            frameBack.ButtonClickEvent += (sender, e) =>
+            {
+                if (this.CanClick == false)
+                {
+                    return;
+                }
+                //鏈垎閰�
+                this.unalloctedRoom = new UnallocatedRoomForm();
+                this.AddChidren(unalloctedRoom);
+                unalloctedRoom.ShowForm();
+                unalloctedRoom.FormCloseEvent += () =>
+                {
+                    //鎵嬪姩鐐瑰嚮鍏抽棴鐨勮瘽,鐩存帴缃┖
+                    this.unalloctedRoom = null;
+                };
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 鍏抽棴鏈垎閰嶇晫闈____________________
+
+        /// <summary>
+        /// 鍏抽棴鏈垎閰嶇晫闈�
+        /// </summary>
+        public void CloseUnallocatedRoomForm()
+        {
+            //鍏抽棴鐣岄潰
+            this.unalloctedRoom?.CloseForm();
+            this.unalloctedRoom = null;
+        }
+
+        #endregion
+
+        #region 鈻� 鍒锋柊鎸囧畾鎴块棿_______________________
+
+        /// <summary>
+        /// 鍒锋柊鎸囧畾鎴块棿
+        /// </summary>
+        /// <param name="room"></param>
+        public void RefreshRoomInfo(Room room)
+        {
+            if (this.dicCardControl.ContainsKey(room.Id) == true)
+            {
+                //鍒锋柊鍗$墖淇℃伅
+                this.dicCardControl[room.Id].RefreshControl();
+            }
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0