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/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs |  176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 176 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs
new file mode 100755
index 0000000..373ef5d
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceRoomControl.cs
@@ -0,0 +1,176 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter
+{
+    /// <summary>
+    /// 鍋氭垚涓�涓樉绀鸿澶囧洖璺�+鎴块棿鐨凴owLayout
+    /// </summary>
+    public class DeviceRoomControl : RowLayoutControl
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 璁惧涓婚敭
+        /// </summary>
+        private string mainKey = string.Empty;
+        /// <summary>
+        /// 璁惧瀵硅薄
+        /// </summary>
+        public CommonDevice device
+        {
+            get { return Common.LocalDevice.Current.GetDevice(mainKey); }
+        }
+        /// <summary>
+        /// 鍦ㄧ嚎鐘舵��
+        /// </summary>
+        private bool m_isOnline = true;
+        /// <summary>
+        /// 鍦ㄧ嚎鐘舵��
+        /// </summary>
+        public bool IsOnline
+        {
+            get { return m_isOnline; }
+            set
+            {
+                if (m_isOnline != value)
+                {
+                    m_isOnline = value;
+                    //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
+                    this.SetOnlineStatu(m_isOnline);
+                }
+            }
+        }
+        /// <summary>
+        /// 鍥炬爣鎺т欢
+        /// </summary>
+        public IconViewControl btnIcon = null;
+        /// <summary>
+        /// 璁惧鎺т欢
+        /// </summary>
+        public NormalViewControl btnDevie = null;
+        /// <summary>
+        /// 鎴块棿鎺т欢
+        /// </summary>
+        public NormalViewControl btnRoom = null;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鍋氭垚涓�涓樉绀鸿澶囧洖璺�+鎴块棿鐨凴owLayout
+        /// </summary>
+        /// <param name="i_device">璁惧瀵硅薄</param>
+        /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param>
+        public DeviceRoomControl(CommonDevice i_device, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
+        {
+            this.mainKey = Common.LocalDevice.Current.GetDeviceMainKeys(i_device);
+        }
+
+        /// <summary>
+        /// 鍋氭垚涓�涓樉绀鸿澶囧洖璺�+鎴块棿鐨凴owLayout
+        /// </summary>
+        /// <param name="deviceMac">璁惧Mac鍦板潃</param>
+        /// <param name="deviceEpoint">璁惧绔彛</param>
+        /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param>
+        public DeviceRoomControl(string deviceMac, int deviceEpoint, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
+        {
+            this.mainKey = Common.LocalDevice.Current.GetDeviceMainKeys(deviceMac, deviceEpoint);
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栧唴閮ㄦ帶浠�
+        /// </summary>
+        public void InitControl()
+        {
+            var tempDevice = device;
+            //鍥炬爣
+            btnIcon = frameTable.AddLeftIcon();
+            Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, tempDevice);
+
+            //璁惧
+            btnDevie = frameTable.AddLeftCaption("", 600, 60);
+            btnDevie.TextSize = 15;
+            //杩欎釜鍧愭爣鏈夌偣鐗规畩
+            btnDevie.Y = Application.GetRealHeight(12) + this.chidrenYaxis;
+            frameTable.AddChidren(btnDevie, ChidrenBindMode.BindEvent);
+            if (tempDevice != null)
+            {
+                btnDevie.Text = Common.LocalDevice.Current.GetDeviceEpointName(tempDevice);
+            }
+            else
+            {
+                //鏃犳硶璇嗗埆鐨勮澶�
+                btnDevie.Text = Language.StringByID(R.MyInternationalizationString.uUnDistinguishTheDevice);
+                btnDevie.TextColor = 0xfff62f48;
+            }
+
+            //鎴块棿
+            btnRoom = frameTable.AddLeftCaption("", 600, 50, true);
+            //杩欎釜鍧愭爣鏈夌偣鐗规畩
+            btnRoom.Y = Application.GetRealHeight(72) + this.chidrenYaxis;
+            btnRoom.TextSize = 12;
+            btnRoom.TextColor = UserCenterColor.Current.TextGrayColor1;
+            frameTable.AddChidren(btnRoom, ChidrenBindMode.BindEvent);
+            if (tempDevice != null)
+            {
+                btnRoom.Text = HdlRoomLogic.Current.GetRoomNameByDevice(tempDevice);
+            }
+            else
+            {
+                //鏈垎閰嶅尯鍩�
+                btnRoom.Text = Language.StringByID(R.MyInternationalizationString.uDeviceNotAssignedRoom);
+                btnRoom.TextColor = 0xfff62f48;
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 鍒锋柊淇℃伅___________________________
+
+        /// <summary>
+        /// 鍒锋柊鍏ㄩ儴鏄剧ず淇℃伅
+        /// </summary>
+        /// <param name="i_device"></param>
+        public void RefreshControlInfo()
+        {
+            var tempDevice = device;
+            if (tempDevice == null)
+            {
+                return;
+            }
+            btnDevie.Text = Common.LocalDevice.Current.GetDeviceEpointName(tempDevice);
+            btnRoom.Text = HdlRoomLogic.Current.GetRoomNameByDevice(tempDevice);
+
+            string unSelectPath = string.Empty;
+            string selectPath = string.Empty;
+            Common.LocalDevice.Current.GetDeviceIcon(tempDevice, ref unSelectPath, ref selectPath);
+
+            btnIcon.UnSelectedImagePath = unSelectPath;
+        }
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
+        /// </summary>
+        /// <param name="i_isOnline"></param>
+        private void SetOnlineStatu(bool i_isOnline)
+        {
+            if (i_isOnline == false)
+            {
+                btnDevie.TextColor = UserCenterColor.Current.TextGrayColor1;
+            }
+            else
+            {
+                btnDevie.TextColor = UserCenterColor.Current.TextColor1;
+            }
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0