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/Controls/ListRoomCardControl.cs |   44 ++++++++++++++++++++++++++------------------
 1 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs
index d0773fd..6c4e949 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs
@@ -8,7 +8,7 @@
     /// <summary>
     /// 宸︽粦鐨勬埧闂村垪琛ㄧ晫闈㈤噷闈㈢殑鎴块棿鍗$墖鎺т欢
     /// </summary>
-    public class ListRoomCardControl : FrameLayoutControl
+    public class ListRoomCardControl : FrameLayoutStatuControl
     {
         #region 鈻� 鍙橀噺澹版槑___________________________
 
@@ -24,6 +24,10 @@
         /// 鎴块棿鍚嶇О鎺т欢
         /// </summary>
         private NormalViewControl btnRoomName = null;
+        /// <summary>
+        /// 鎴块棿鍚嶅瓧鐨勮儗鏅�
+        /// </summary>
+        private NormalViewControl btnRoomNameBackGroud = null;
 
         #endregion
 
@@ -34,8 +38,8 @@
         /// </summary>
         public ListRoomCardControl()
         {
-            this.Width = Application.GetRealWidth(495);
-            this.Height = Application.GetRealHeight(354);
+            this.Width = HdlControlLogic.Current.GetPictrueRealSize(495);
+            this.Height = HdlControlLogic.Current.GetPictrueRealSize(354);
         }
 
         /// <summary>
@@ -54,8 +58,8 @@
             //鎴块棿鍥剧墖
             this.picRoom = new ImageView();
             picRoom.Gravity = Gravity.CenterHorizontal;
-            picRoom.Width = Application.GetRealWidth(467);
-            picRoom.Height = Application.GetRealHeight(311);
+            picRoom.Width = HdlControlLogic.Current.GetPictrueRealSize(467);
+            picRoom.Height = HdlControlLogic.Current.GetPictrueRealSize(311);
             picRoom.Radius = (uint)Application.GetRealHeight(29);
             this.AddChidren(picRoom, ChidrenBindMode.NotBind);
 
@@ -64,22 +68,22 @@
             frameBack.Gravity = picRoom.Gravity;
             frameBack.Radius = picRoom.Radius;
             frameBack.BackgroundColor = 0x33000000;
-            this.AddChidren(picRoom, ChidrenBindMode.BindEventOnly);
+            this.AddChidren(picRoom, ChidrenBindMode.BindEvent);
 
             //鎴块棿鍚嶅瓧鐨勮儗鏅�
-            var btnRoomNameBackGroud = new NormalViewControl(Application.GetRealWidth(141), Application.GetRealHeight(84), false);
-            btnRoomNameBackGroud.X = Application.GetRealWidth(14);
-            btnRoomNameBackGroud.UnSelectedImagePath = "Room/RoomCardView_Name.png";
-            this.AddChidren(btnRoomNameBackGroud, ChidrenBindMode.BindEventOnly);
+            this.btnRoomNameBackGroud = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(141), Application.GetRealHeight(84), false);
+            btnRoomNameBackGroud.X = HdlControlLogic.Current.GetPictrueRealSize(14);
+            btnRoomNameBackGroud.BackgroundColor = 0x80000000;
+            this.AddChidren(btnRoomNameBackGroud, ChidrenBindMode.BindEvent);
 
             //鎴块棿鍚嶅瓧
-            this.btnRoomName = new NormalViewControl(btnRoomNameBackGroud.Width, btnRoomNameBackGroud.Height, false);
-            btnRoomName.X = Application.GetRealWidth(14);
+            this.btnRoomName = new NormalViewControl(50, Application.GetRealHeight(84), false);
+            btnRoomName.X = HdlControlLogic.Current.GetPictrueRealSize(14);
             btnRoomName.TextSize = 12;
             btnRoomName.IsBold = true;
             btnRoomName.TextAlignment = TextAlignment.Center;
             btnRoomName.TextColor = UserCenterColor.Current.White;
-            this.AddChidren(btnRoomName, ChidrenBindMode.BindEventOnly);
+            this.AddChidren(btnRoomName, ChidrenBindMode.BindEvent);
 
             //鍒锋柊鎺т欢淇℃伅
             this.RefreshControl();
@@ -99,15 +103,19 @@
             {
                 //鍒锋柊鍚嶅瓧
                 btnRoomName.Text = room.Name;
-                if (btnRoomName.GetRealWidthByText() > Application.GetRealWidth(141))
+                int realWidth = btnRoomName.GetRealWidthByText() + HdlControlLogic.Current.GetPictrueRealSize(70);
+                if (realWidth < HdlControlLogic.Current.GetPictrueRealSize(141))
                 {
-                    //瀛椾綋闀垮害瓒呰繃
-                    btnRoomName.TextAlignment = TextAlignment.CenterLeft;
+                    realWidth = HdlControlLogic.Current.GetPictrueRealSize(141);
                 }
-                else
+                else if (realWidth > HdlControlLogic.Current.GetPictrueRealSize(420))
                 {
-                    btnRoomName.TextAlignment = TextAlignment.Center;
+                    realWidth = HdlControlLogic.Current.GetPictrueRealSize(420);
                 }
+                btnRoomName.Width = realWidth;
+                btnRoomNameBackGroud.Width = realWidth;
+                btnRoomNameBackGroud.SetCornerWithSameRadius(picRoom.Radius, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomRight);
+
                 //鍒锋柊鍥剧墖
                 if (room.BackgroundImageType == 0)
                 {

--
Gitblit v1.8.0