From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期二, 21 七月 2020 09:46:53 +0800 Subject: [PATCH] 请合并最新多功能面板代码 --- ZigbeeApp/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs | 133 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 133 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs new file mode 100755 index 0000000..6c4e949 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/ListRoomCardControl.cs @@ -0,0 +1,133 @@ +锘縰sing Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 宸︽粦鐨勬埧闂村垪琛ㄧ晫闈㈤噷闈㈢殑鎴块棿鍗$墖鎺т欢 + /// </summary> + public class ListRoomCardControl : FrameLayoutStatuControl + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 鎴块棿ID + /// </summary> + private string roomId = string.Empty; + /// <summary> + /// 鎴块棿鍥剧墖鎺т欢 + /// </summary> + private ImageView picRoom = null; + /// <summary> + /// 鎴块棿鍚嶇О鎺т欢 + /// </summary> + private NormalViewControl btnRoomName = null; + /// <summary> + /// 鎴块棿鍚嶅瓧鐨勮儗鏅� + /// </summary> + private NormalViewControl btnRoomNameBackGroud = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 宸︽粦鐨勬埧闂村垪琛ㄧ晫闈㈤噷闈㈢殑鎴块棿鍗$墖鎺т欢 + /// </summary> + public ListRoomCardControl() + { + this.Width = HdlControlLogic.Current.GetPictrueRealSize(495); + this.Height = HdlControlLogic.Current.GetPictrueRealSize(354); + } + + /// <summary> + /// 鍒濆鍖栨埧闂村崱鐗囨帶浠� + /// </summary> + /// <param name="room"></param> + public void InitControl(Common.Room room) + { + this.roomId = room.Id; + + //鎴块棿搴曢儴闃村奖鏁堟灉 + var btnRoomShadow = new NormalViewControl(this.Width, this.Height, false); + btnRoomShadow.UnSelectedImagePath = "Room/RoomCardView.png"; + this.AddChidren(btnRoomShadow, ChidrenBindMode.NotBind); + + //鎴块棿鍥剧墖 + this.picRoom = new ImageView(); + picRoom.Gravity = Gravity.CenterHorizontal; + picRoom.Width = HdlControlLogic.Current.GetPictrueRealSize(467); + picRoom.Height = HdlControlLogic.Current.GetPictrueRealSize(311); + picRoom.Radius = (uint)Application.GetRealHeight(29); + this.AddChidren(picRoom, ChidrenBindMode.NotBind); + + //閬僵 + var frameBack = new NormalViewControl(picRoom.Width, picRoom.Height, false); + frameBack.Gravity = picRoom.Gravity; + frameBack.Radius = picRoom.Radius; + frameBack.BackgroundColor = 0x33000000; + this.AddChidren(picRoom, ChidrenBindMode.BindEvent); + + //鎴块棿鍚嶅瓧鐨勮儗鏅� + 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(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.BindEvent); + + //鍒锋柊鎺т欢淇℃伅 + this.RefreshControl(); + } + + #endregion + + #region 鈻� 鍒锋柊鎺т欢___________________________ + + /// <summary> + /// 鍒锋柊鎺т欢淇℃伅 + /// </summary> + public void RefreshControl() + { + var room = HdlRoomLogic.Current.GetRoomById(this.roomId); + if (room != null) + { + //鍒锋柊鍚嶅瓧 + btnRoomName.Text = room.Name; + int realWidth = btnRoomName.GetRealWidthByText() + HdlControlLogic.Current.GetPictrueRealSize(70); + if (realWidth < HdlControlLogic.Current.GetPictrueRealSize(141)) + { + realWidth = HdlControlLogic.Current.GetPictrueRealSize(141); + } + else if (realWidth > HdlControlLogic.Current.GetPictrueRealSize(420)) + { + realWidth = HdlControlLogic.Current.GetPictrueRealSize(420); + } + btnRoomName.Width = realWidth; + btnRoomNameBackGroud.Width = realWidth; + btnRoomNameBackGroud.SetCornerWithSameRadius(picRoom.Radius, HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomRight); + + //鍒锋柊鍥剧墖 + if (room.BackgroundImageType == 0) + { + picRoom.ImagePath = room.BackgroundImage; + } + else + { + picRoom.ImagePath = System.IO.Path.Combine(Common.Config.Instance.FullPath, room.BackgroundImage); + } + } + } + + #endregion + } +} -- Gitblit v1.8.0