From 2be70a32d2a8c517bd9868fb60913fcc843e66fe Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 13 五月 2020 11:21:32 +0800
Subject: [PATCH] 上传代码

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs |  145 +++++++++++++++++++++++++++++++----------------
 1 files changed, 95 insertions(+), 50 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
index d907473..1e53f96 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
@@ -13,11 +13,27 @@
         #region 鈻� 鍙橀噺澹版槑___________________________
 
         /// <summary>
-        /// 鍒ゆ柇璇ユ帶浠惰兘鍚︽樉绀�(鏈�濂界‘淇濊澶囧璞′笉涓簄ull)
+        /// 缁撴潫閫夋嫨鐨勪簨浠� value:绱㈠紩(浠�0寮�濮�)  鏂囨湰淇℃伅璇风敤Text鑾峰彇
+        /// </summary>
+        public Action<int> FinishSelectEvent = null;
+        /// <summary>
+        /// 鍒ゆ柇璇ユ帶浠惰兘鍚︽樉绀�
         /// </summary>
         public bool CanShowRow
         {
             get { return this.CheckCanShowRow(); }
+        }
+
+        private bool m_SetCanSelect = true;
+        /// <summary>
+        /// 寮哄埗璁剧疆鑳藉惁杩涜閫夋嫨(鍙缁х數鍣ㄥ拰绌烘皵寮�鍏虫湁鏁�,涓埆鐣岄潰闇�瑕佽繖绉嶆搷浣�)
+        /// </summary>
+        public bool SetCanSelect
+        {
+            set 
+            {
+                m_SetCanSelect = value;
+            }
         }
         /// <summary>
         /// 璁惧瀵硅薄
@@ -33,10 +49,10 @@
         #region 鈻� 鍒濆鍖朹____________________________
 
         /// <summary>
-        /// 璁惧鍔熻兘绫诲瀷鐨勮嚜瀹氫箟琛屾帶浠�(姝ゆ柟娉曢�夋嫨涔嬪悗,鏃犳潯浠剁洿鎺ュ彉鏇寸被鍨�)
+        /// 璁惧鍔熻兘绫诲瀷鐨勮嚜瀹氫箟琛屾帶浠�(閫夋嫨鍔熻兘涔嬪悗,鏃犳潯浠剁洿鎺ュ彉鏇寸被鍨�)
         /// </summary>
         /// <param name="i_device">璁惧鐨勫璞�</param>
-        /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param>
+        /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param>
         public DeviceFunctionTypeRowControl(CommonDevice i_device, int i_ChidrenYaxis = 0) : base("", "", i_ChidrenYaxis)
         {
             this.device = i_device;
@@ -53,25 +69,23 @@
             //鍒濆鍖栧簳灞傛暟鎹�
             base.InitControl();
 
-            if (this.device == null)
-            {
-                //姝ゆ帶浠堕噰鐢ㄧ殑鏄彟澶栦竴绉嶅垵濮嬪寲鏂瑰紡
-                return;
-            }
-
             //绌烘皵寮�鍏冲拰缁х數鍣ㄥ彲浠ラ�夋嫨鍔熻兘绫诲瀷
             if (this.device.Type == DeviceType.AirSwitch
                 || this.device.Type == DeviceType.OnOffOutput)
             {
-                this.UseClickStatu = true;
-                //鍙崇澶�
-                this.AddRightArrow();
-
-                this.ButtonClickEvent += (sender, e) =>
+                //娌¤寮哄埗骞叉秹鐨勮瘽
+                if (m_SetCanSelect == true)
                 {
-                    //鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷鐨勭晫闈�
-                    this.ShowSelectDeviceFunctionListForm();
-                };
+                    this.UseClickStatu = true;
+                    //鍙崇澶�
+                    this.AddRightArrow();
+
+                    this.ButtonClickEvent += (sender, e) =>
+                    {
+                        //鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷鐨勭晫闈�
+                        this.ShowSelectDeviceFunctionListForm();
+                    };
+                }
             }
         }
 
@@ -97,12 +111,23 @@
             form.AddForm(title, listText, nowSelectNo);
             form.FinishSelectEvent += (selectNo) =>
             {
+                if (selectNo == nowSelectNo)
+                {
+                    //閫夋嫨鐨勬槸鐩稿悓鐨�
+                    return;
+                }
                 //-1:閫夋嫨鍙栨秷
                 this.Text = selectNo == -1 ? string.Empty : listText[selectNo];
                 nowSelectNo = selectNo;
 
                 //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨�
                 this.RefreshDfunctionType();
+
+                //璁惧鏀瑰彉鍔熻兘绫诲瀷鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
+                UserView.UserPage.Instance.RefreshForm = true;
+
+                //璋冪敤鍥炶皟鍑芥暟
+                this.FinishSelectEvent?.Invoke(nowSelectNo);
             };
         }
         #endregion
@@ -117,12 +142,7 @@
             //鏍囬锛氬姛鑳界被鍨�
             this.btnCaption.Text = Language.StringByID(R.MyInternationalizationString.uFunctionType);
 
-            var myFunType = DeviceFunctionType.A鏈畾涔�;
-            if (this.device != null)
-            {
-                myFunType = this.device.DfunctionType;
-            }
-
+            var myFunType = this.device.DfunctionType;
             //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛�
             string strType = string.Empty;
             if (myFunType == DeviceFunctionType.A鐏厜)
@@ -141,35 +161,44 @@
                 nowSelectNo = 2;
             }
 
-            //濡傛灉璁惧涓嶄负null
-            if (this.device != null)
+            if (this.device.Type == DeviceType.ColorDimmableLight
+                || this.device.Type == DeviceType.DimmableLight)
             {
-                if (this.device.Type == DeviceType.ColorDimmableLight
-                    || this.device.Type == DeviceType.DimmableLight)
-                {
-                    //鐏厜绫诲浐瀹氫负 鐏厜
-                    strType = Language.StringByID(R.MyInternationalizationString.uLight);
-                    nowSelectNo = 1;
-                }
-                else if (this.device.Type == DeviceType.WindowCoveringDevice)
-                {
-                    //绐楀笜鍥哄畾涓� 閬槼
-                    strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100);
-                    nowSelectNo = -1;
-                }
-                else if (this.device.Type == DeviceType.Thermostat)
-                {
-                    //绌鸿皟鍥哄畾涓� 绌鸿皟
-                    strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId3600);
-                    nowSelectNo = -1;
-                }
-                else if (this.device.Type == DeviceType.DoorLock)
-                {
-                    //闂ㄩ攣鍥哄畾涓� 闂ㄩ攣
-                    strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2800);
-                    nowSelectNo = -1;
-                }
+                //鐏厜绫诲浐瀹氫负 鐏厜
+                strType = Language.StringByID(R.MyInternationalizationString.uLight);
+                nowSelectNo = 1;
             }
+            else if (this.device.Type == DeviceType.WindowCoveringDevice)
+            {
+                //绐楀笜鍥哄畾涓� 閬槼
+                strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100);
+                nowSelectNo = -1;
+            }
+            else if (this.device.Type == DeviceType.Thermostat)
+            {
+                //绌鸿皟鍥哄畾涓� 绌鸿皟
+                strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId3600);
+                nowSelectNo = -1;
+            }
+            else if (this.device.Type == DeviceType.DoorLock)
+            {
+                //闂ㄩ攣鍥哄畾涓� 闂ㄩ攣
+                strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2800);
+                nowSelectNo = -1;
+            }
+            else if (this.device.Type == DeviceType.FreshAir)
+            {
+                //鏂伴鍥哄畾涓� 鏂伴
+                strType = Language.StringByID(R.MyInternationalizationString.FreshAir);
+                nowSelectNo = -1;
+            }
+            else if (this.device.Type == DeviceType.PMSensor)
+            {
+                //PM2.5浼犳劅鍣ㄥ浐瀹氫负 绌烘皵璐ㄩ噺
+                strType = Language.StringByID(R.MyInternationalizationString.AirQuality);
+                nowSelectNo = -1;
+            }
+
             //鏄剧ず鏂囨湰
             this.txtView.Text = strType;
         }
@@ -192,6 +221,8 @@
                 || this.device.Type == DeviceType.DoorLock//闂ㄩ攣
                 || this.device.Type == DeviceType.OnOffOutput//缁х數鍣�
                 || this.device.Type == DeviceType.Thermostat//绌鸿皟
+                || this.device.Type == DeviceType.FreshAir//鏂伴
+                || this.device.Type == DeviceType.PMSensor //PM2.5
                 || this.device.Type == DeviceType.WindowCoveringDevice)//绐楀笜
             {
                 return true;
@@ -201,6 +232,20 @@
 
         #endregion
 
+        #region 鈻� 鎺т欢鎽ф瘉___________________________
+
+        /// <summary>
+        /// 鎺т欢鎽ф瘉
+        /// </summary>
+        public override void RemoveFromParent()
+        {
+            this.FinishSelectEvent = null;
+
+            base.RemoveFromParent();
+        }
+
+        #endregion
+
         #region 鈻� 涓�鑸柟娉昣__________________________
 
         /// <summary>

--
Gitblit v1.8.0