From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 14 十二月 2020 09:59:01 +0800 Subject: [PATCH] 请合并代码,完成晾衣架最终功能。 --- ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomDeviceListForm.cs | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 111 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomDeviceListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomDeviceListForm.cs new file mode 100755 index 0000000..26abce9 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomDeviceListForm.cs @@ -0,0 +1,111 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.Residence +{ + /// <summary> + /// 鎴块棿璁惧涓�瑙堢晫闈� + /// </summary> + public class LookRoomDeviceListForm : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="titleName">鏍囬</param> + /// <param name="detailTile">鏄庣粏鏍囬</param> + /// <param name="listDevice">璁惧鍒楄〃(涓婚敭)</param> + public void ShowForm(string titleName, string detailTile, List<string> listDevice) + { + //璁剧疆澶撮儴淇℃伅 + base.SetTitleText(titleName); + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(detailTile, listDevice); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame(string detailTile, List<string> listDevice) + { + //娓呯┖bodyFrame + this.ClearBodyFrame(); + + var frameTitle = new FrameLayout(); + frameTitle.BackgroundColor = UserCenterColor.Current.White; + frameTitle.Height = Application.GetRealHeight(115); + bodyFrameLayout.AddChidren(frameTitle); + var btnTitle = new NormalViewControl(800, 60, true); + btnTitle.Y = Application.GetRealHeight(49); + btnTitle.X = ControlCommonResourse.XXLeft; + btnTitle.TextSize = 15; + btnTitle.TextColor = UserCenterColor.Current.TextColor2; + btnTitle.Text = detailTile; + frameTitle.AddChidren(btnTitle); + + var listView = new VerticalListControl(23); + listView.Y = frameTitle.Bottom; + listView.Height = bodyFrameLayout.Height - frameTitle.Height; + listView.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(listView); + + HdlThreadLogic.Current.RunMainInThread(() => + { + for (int i = 0; i < listDevice.Count; i++) + { + //鑾峰彇璁惧 + var device = Common.LocalDevice.Current.GetDevice(listDevice[i]); + if (device == null) + { + continue; + } + //娣诲姞璁惧琛� + this.AddDeviceRow(listView, device, i != listDevice.Count - 1); + } + listView.AdjustRealHeight(Application.GetRealHeight(23)); + }); + } + + #endregion + + #region 鈻� 娣诲姞璁惧琛宊________________________ + + /// <summary> + /// 娣诲姞璁惧琛� + /// </summary> + /// <param name="listView"></param> + /// <param name="device"></param> + /// <param name="addLine"></param> + private void AddDeviceRow(VerticalListControl listView, CommonDevice device, bool addLine) + { + var frameRow = new FrameRowControl(listView.rowSpace / 2); + frameRow.UseClickStatu = false; + listView.AddChidren(frameRow); + //鍥炬爣 + var btnIcon = frameRow.AddLeftIcon(81); + Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device); + //璁惧鍚嶅瓧 + var btnName = frameRow.AddLeftCaption(Common.LocalDevice.Current.GetDeviceEpointName(device), 700); + btnName.TextSize = 15; + if (Common.LocalDevice.Current.CheckDeviceIsOnline(device) == false) + { + btnName.TextColor = UserCenterColor.Current.TextGrayColor1; + } + //搴曠嚎 + if (addLine == true) + { + frameRow.AddBottomLine(); + } + } + + #endregion + } +} -- Gitblit v1.8.0