From f71e74b5f0d2716fbf05da016cdaa18d64e09f80 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 31 十二月 2020 17:01:18 +0800
Subject: [PATCH] 又换完成最新门锁。空气质量传感器完成数据和基本配置功能。开发图表和自动化的同事可下载此代码

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs |  776 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 397 insertions(+), 379 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
index ffdd535..8a4ad21 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs
@@ -1,380 +1,398 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Text;
-using ZigBee.Device;
-
-namespace Shared.Phone.UserCenter
-{
-    /// <summary>
-    /// 璁惧鍔熻兘绫诲瀷鐨勮嚜瀹氫箟琛屾帶浠�
-    /// </summary>
-    public class DeviceFunctionTypeRowControl : FrameCaptionViewControl
-    {
-        #region 鈻� 鍙橀噺澹版槑___________________________
-
-        /// <summary>
-        /// 缁撴潫閫夋嫨鐨勪簨浠� 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>
-        /// 璁惧瀵硅薄
-        /// </summary>
-        private CommonDevice device = null;
-        /// <summary>
-        /// 褰撳墠閫夋嫨鐨勫姛鑳界被鍨嬬储寮� -1:杩樻病鏈夎缃繃 0:涓嶆寚瀹� 1:寮�鍏� 2:鐏厜 3:鎻掑骇
-        /// </summary>
-        private int nowSelectNo = -1;
-
-        #endregion
-
-        #region 鈻� 鍒濆鍖朹____________________________
-
-        /// <summary>
-        /// 璁惧鍔熻兘绫诲瀷鐨勮嚜瀹氫箟琛屾帶浠�(閫夋嫨鍔熻兘涔嬪悗,鏃犳潯浠剁洿鎺ュ彉鏇寸被鍨�)
-        /// </summary>
-        /// <param name="i_device">璁惧鐨勫璞�</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;
-            this.UseClickStatu = false;
-        }
-
-        /// <summary>
-        /// 鍒濆鍖�
-        /// </summary>
-        public override void InitControl()
-        {
-            //鍒濆鍖栧垵濮嬫暟鎹�
-            this.InitDefultData();
-            //鍒濆鍖栧簳灞傛暟鎹�
-            base.InitControl();
-
-            //绌烘皵寮�鍏冲拰缁х數鍣ㄥ彲浠ラ�夋嫨鍔熻兘绫诲瀷
-            if (this.device.Type == DeviceType.AirSwitch
-                || this.device.Type == DeviceType.OnOffOutput)
-            {
-                //娌¤寮哄埗骞叉秹鐨勮瘽
-                if (m_SetCanSelect == true && Common.Config.Instance.Home.IsShowTemplate == false)
-                {
-                    this.UseClickStatu = true;
-                    //鍙崇澶�
-                    this.AddRightArrow();
-
-                    //璇诲彇璁惧鍔熻兘绫诲瀷
-                    this.ReadDeviceFunctionType();
-
-                    this.ButtonClickEvent += (sender, e) =>
-                    {
-                        //鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷鐨勭晫闈�
-                        this.ShowSelectDeviceFunctionListForm();
-                    };
-                }
-            }
-        }
-
-        #endregion
-
-        #region 鈻� 鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷_______________
-
-        /// <summary>
-        /// 鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷鐨勭晫闈�
-        /// </summary>
-        private void ShowSelectDeviceFunctionListForm()
-        {
-            //鏄剧ず鍒楄〃
-            var listText = new List<string>();
-            listText.Add(Language.StringByID(R.MyInternationalizationString.uSwitch));//寮�鍏�
-            listText.Add(Language.StringByID(R.MyInternationalizationString.uLight));//鐏厜
-            listText.Add(Language.StringByID(R.MyInternationalizationString.uSocket1));//鎻掑骇
-            //鏍囬:閫夋嫨鍔熻兘绫诲瀷
-            var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType);
-
-            var form = new BottomItemSelectForm();
-            form.CancelCallEvent = true;//鍏佽鍙栨秷
-            form.AddForm(title, listText, null, nowSelectNo - 1);
-            form.FinishSelectEvent += (selectNo) =>
-            {
-                if (selectNo == nowSelectNo - 1)
-                {
-                    //閫夋嫨鐨勬槸鐩稿悓鐨�
-                    return;
-                }
-                //-1:閫夋嫨鍙栨秷
-                this.Text = selectNo == -1 ? string.Empty : listText[selectNo];
-                nowSelectNo = selectNo + 1;
-
-                this.CanClick = false;
-                HdlThreadLogic.Current.RunThread(() =>
-                {
-                    //璁剧疆鍔熻兘绫诲瀷鍒扮綉鍏�
-                    var result = Common.LocalDevice.Current.SendDeviceFunctionTypeToGateway(this.device, (DeviceFunctionType)nowSelectNo);
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
 
-                    HdlThreadLogic.Current.RunMain(() =>
-                    {
-                        if (result == true)
-                        {
-                            //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨�
-                            this.RefreshDfunctionType();
-
-                            //璁惧鏀瑰彉鍔熻兘绫诲瀷鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
-                            UserView.UserPage.Instance.RefreshAllForm = true;
-
-                            //璋冪敤鍥炶皟鍑芥暟
-                            this.FinishSelectEvent?.Invoke(nowSelectNo);
-                        }
-                        else
-                        {
-                            //璁剧疆璁惧鍔熻兘绫诲瀷澶辫触
-                            var alert = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uSetDeviceFunctionTypeFail));
-                            alert.Show();
-                        }
-                        this.CanClick = true;
-                    });
-                });
-            };
-        }
-        #endregion
-
-        #region 鈻� 鍒濆鍖栧垵濮嬫暟鎹甠____________________
-
-        /// <summary>
-        /// 鍒濆鍖栧垵濮嬫暟鎹�
-        /// </summary>
-        private void InitDefultData()
-        {
-            //鏍囬锛氬姛鑳界被鍨�
-            this.btnCaption.Text = Language.StringByID(R.MyInternationalizationString.uFunctionType);
-
-            var myFunType = this.device.DfunctionType;
-            //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛�
-            string strType = string.Empty;
-
-            if (this.device.DfunctionType == DeviceFunctionType.A涓嶆寚瀹�)
-            {
-                nowSelectNo = 0;
-            }
-            else if (this.device.DfunctionType == DeviceFunctionType.A寮�鍏�)
-            {
-                strType = Language.StringByID(R.MyInternationalizationString.uSwitch);
-                nowSelectNo = 1;
-            }
-            else if (myFunType == DeviceFunctionType.A鐏厜)
-            {
-                strType = Language.StringByID(R.MyInternationalizationString.uLight);
-                nowSelectNo = 2;
-            }
-            else if (this.device.DfunctionType == DeviceFunctionType.A鎻掑骇)
-            {
-                strType = Language.StringByID(R.MyInternationalizationString.uSocket1);
-                nowSelectNo = 3;
-            }
-
-            if (this.device.Type == DeviceType.ColorDimmableLight
-                || this.device.Type == DeviceType.ColorTemperatureLight
-                || this.device.Type == DeviceType.DimmableLight)
-            {
-                //鐏厜绫诲浐瀹氫负 鐏厜
-                var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A418");
-                strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
-                nowSelectNo = 2;
-            }
-            else if (this.device.Type == DeviceType.WindowCoveringDevice)
-            {
-                //绐楀笜鍥哄畾涓� 閬槼
-                var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A400");
-                strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
-                nowSelectNo = -1;
-            }
-            else if (this.device.Type == DeviceType.Thermostat)
-            {
-                //绌鸿皟鍥哄畾涓� 绌鸿皟
-                var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A406");
-                strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
-                nowSelectNo = -1;
-            }
-            else if (this.device.Type == DeviceType.DoorLock)
-            {
-                //闂ㄩ攣鍥哄畾涓� 闂ㄩ攣
-                var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A405");
-                strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
-                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;
-            }
-            else if (this.device.Type == DeviceType.Airer)
-            {
-                //鏅捐。鏋�
-                strType = Language.StringByID(R.MyInternationalizationString.AirerFun);
-                nowSelectNo = -1;
-            }
-            else if (this.device.Type == DeviceType.PMSensor)
-            {
-                //绌烘皵璐ㄩ噺浼犳劅鍣� 鐜  
-                strType = Language.StringByID(R.MyInternationalizationString.Envoronment);
-                nowSelectNo = -1;
-            }
-
-            //鏄剧ず鏂囨湰
-            this.txtView.Text = strType;
-        }
-
-        #endregion
-
-        #region 鈻� 妫�娴嬭兘鍚︽樉绀篲______________________
-
-        /// <summary>
-        /// 妫�娴嬭兘鍚︽樉绀�
-        /// </summary>
-        /// <returns></returns>
-        private bool CheckCanShowRow()
-        {
-            if (this.device == null) { return true; }
-
-            if (this.device.Type == DeviceType.AirSwitch//绌烘皵寮�鍏�
-                || this.device.Type == DeviceType.ColorDimmableLight//褰╃伅
-                || this.device.Type == DeviceType.DimmableLight//璋冨厜鐏�
-                || 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.Airer//鏅捐。鏋�
-                || this.device.Type == DeviceType.ColorTemperatureLight //鑹叉俯鐏�
-                || this.device.Type == DeviceType.WindowCoveringDevice)//绐楀笜
-            {
-                return true;
-            }
-            return false;
-        }
-
-        #endregion
-
-        #region 鈻� 鎺т欢鎽ф瘉___________________________
-
-        /// <summary>
-        /// 鎺т欢鎽ф瘉
-        /// </summary>
-        public override void RemoveFromParent()
-        {
-            this.FinishSelectEvent = null;
-
-            base.RemoveFromParent();
-        }
-
-        #endregion
-
-        #region 鈻� 涓�鑸柟娉昣__________________________
-
-        /// <summary>
-        /// 鍒锋柊璁惧鍔熻兘绫诲瀷
-        /// </summary>
-        private void RefreshDfunctionType()
-        {
-            if (this.nowSelectNo == 1)
-            {
-                this.device.DfunctionType = DeviceFunctionType.A寮�鍏�;
-                if (this.device.IsCustomizeImage == false)
-                {
-                    //閲嶆柊璁剧疆鍥剧墖
-                    this.device.IconPath = "Device/Switch.png";
-                }
-            }
-            else if (this.nowSelectNo == 2)
-            {
-                this.device.DfunctionType = DeviceFunctionType.A鐏厜;
-                if (this.device.IsCustomizeImage == false)
-                {
-                    //閲嶆柊璁剧疆鍥剧墖
-                    this.device.IconPath = "Device/Light.png";
-                }
-            }
-            else if (this.nowSelectNo == 3)
-            {
-                this.device.DfunctionType = DeviceFunctionType.A鎻掑骇;
-                if (this.device.IsCustomizeImage == false)
-                {
-                    //閲嶆柊璁剧疆鍥剧墖
-                    this.device.IconPath = "Device/Socket1.png";
-                }
-            }
-            else
-            {
-                this.device.DfunctionType = DeviceFunctionType.A涓嶆寚瀹�;
-                if (this.device.IsCustomizeImage == false)
-                {
-                    //閲嶆柊璁剧疆鍥剧墖
-                    if (this.device.Type == DeviceType.AirSwitch)
-                    {
-                        //绌烘皵寮�鍏�
-                        this.device.IconPath = "Device/Switch.png";
-                    }
-                    else if (this.device.Type == DeviceType.OnOffOutput)
-                    {
-                        //缁х數鍣�
-                        this.device.IconPath = "Device/RelayEpoint.png";
-                    }
-                }
-            }
-            this.device.ReSave();
-        }
-
-        #endregion
-
-        #region 鈻� 璇诲彇璁惧鍔熻兘绫诲瀷___________________
-
-        /// <summary>
-        /// 璇诲彇璁惧鍔熻兘绫诲瀷
-        /// </summary>
-        private void ReadDeviceFunctionType()
-        {
-            HdlThreadLogic.Current.RunThread(() =>
-            {
-                //璇诲彇璁惧鍔熻兘绫诲瀷
-                var info = Common.LocalDevice.Current.ReadDeviceEpointDeviceInfo(this.device);
-                if (info != null && ((int)this.device.DfunctionType) != info.FunctionType)
-                {
-                    this.device.DfunctionType = (DeviceFunctionType)info.FunctionType;
-                    HdlThreadLogic.Current.RunMain(() =>
-                    {
-                        //鍒锋柊鎺т欢
-                        this.InitDefultData();
-                        //鍒锋柊璁惧鍔熻兘绫诲瀷
-                        this.RefreshDfunctionType();
-                    });
-                }
-            });
-        }
-
-        #endregion
-    }
-}
+namespace Shared.Phone.UserCenter
+{
+  /// <summary>
+  /// 璁惧鍔熻兘绫诲瀷鐨勮嚜瀹氫箟琛屾帶浠�
+  /// </summary>
+  public class DeviceFunctionTypeRowControl : FrameCaptionViewControl
+  {
+    #region 鈻� 鍙橀噺澹版槑___________________________
+
+    /// <summary>
+    /// 缁撴潫閫夋嫨鐨勪簨浠� 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>
+    /// 璁惧瀵硅薄
+    /// </summary>
+    private CommonDevice device = null;
+    /// <summary>
+    /// 褰撳墠閫夋嫨鐨勫姛鑳界被鍨嬬储寮� -1:杩樻病鏈夎缃繃 0:涓嶆寚瀹� 1:寮�鍏� 2:鐏厜 3:鎻掑骇
+    /// </summary>
+    private int nowSelectNo = -1;
+
+    #endregion
+
+    #region 鈻� 鍒濆鍖朹____________________________
+
+    /// <summary>
+    /// 璁惧鍔熻兘绫诲瀷鐨勮嚜瀹氫箟琛屾帶浠�(閫夋嫨鍔熻兘涔嬪悗,鏃犳潯浠剁洿鎺ュ彉鏇寸被鍨�)
+    /// </summary>
+    /// <param name="i_device">璁惧鐨勫璞�</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;
+      this.UseClickStatu = false;
+    }
+
+    /// <summary>
+    /// 鍒濆鍖�
+    /// </summary>
+    public override void InitControl()
+    {
+      //鍒濆鍖栧垵濮嬫暟鎹�
+      this.InitDefultData();
+      //鍒濆鍖栧簳灞傛暟鎹�
+      base.InitControl();
+
+      //绌烘皵寮�鍏冲拰缁х數鍣ㄥ彲浠ラ�夋嫨鍔熻兘绫诲瀷
+      if (this.device.Type == DeviceType.AirSwitch
+          || this.device.Type == DeviceType.OnOffOutput)
+      {
+        //娌¤寮哄埗骞叉秹鐨勮瘽
+        if (m_SetCanSelect == true && Common.Config.Instance.Home.IsShowTemplate == false)
+        {
+          this.UseClickStatu = true;
+          //鍙崇澶�
+          this.AddRightArrow();
+
+          //璇诲彇璁惧鍔熻兘绫诲瀷
+          this.ReadDeviceFunctionType();
+
+          this.ButtonClickEvent += (sender, e) =>
+          {
+            //鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷鐨勭晫闈�
+            this.ShowSelectDeviceFunctionListForm();
+          };
+        }
+      }
+    }
+
+    #endregion
+
+    #region 鈻� 鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷_______________
+
+    /// <summary>
+    /// 鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷鐨勭晫闈�
+    /// </summary>
+    private void ShowSelectDeviceFunctionListForm()
+    {
+      //鏄剧ず鍒楄〃
+      var listText = new List<string>();
+      listText.Add(Language.StringByID(R.MyInternationalizationString.uSwitch));//寮�鍏�
+      listText.Add(Language.StringByID(R.MyInternationalizationString.uLight));//鐏厜
+      listText.Add(Language.StringByID(R.MyInternationalizationString.uSocket1));//鎻掑骇
+                                                                                 //鏍囬:閫夋嫨鍔熻兘绫诲瀷
+      var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType);
+
+      var form = new BottomItemSelectForm();
+      form.CancelCallEvent = true;//鍏佽鍙栨秷
+      form.AddForm(title, listText, null, nowSelectNo - 1);
+      form.FinishSelectEvent += (selectNo) =>
+      {
+        if (selectNo == nowSelectNo - 1)
+        {
+          //閫夋嫨鐨勬槸鐩稿悓鐨�
+          return;
+        }
+        //-1:閫夋嫨鍙栨秷
+        this.Text = selectNo == -1 ? string.Empty : listText[selectNo];
+        nowSelectNo = selectNo + 1;
+
+        this.CanClick = false;
+        HdlThreadLogic.Current.RunThread(() =>
+              {
+                //璁剧疆鍔熻兘绫诲瀷鍒扮綉鍏�
+                var result = Common.LocalDevice.Current.SendDeviceFunctionTypeToGateway(this.device, (DeviceFunctionType)nowSelectNo);
+
+                HdlThreadLogic.Current.RunMain(() =>
+                      {
+                        if (result == true)
+                        {
+                          //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨�
+                          this.RefreshDfunctionType();
+
+                          //璁惧鏀瑰彉鍔熻兘绫诲瀷鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
+                          UserView.UserPage.Instance.RefreshAllForm = true;
+
+                          //璋冪敤鍥炶皟鍑芥暟
+                          this.FinishSelectEvent?.Invoke(nowSelectNo);
+                        }
+                        else
+                        {
+                          //璁剧疆璁惧鍔熻兘绫诲瀷澶辫触
+                          var alert = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uSetDeviceFunctionTypeFail));
+                          alert.Show();
+                        }
+                        this.CanClick = true;
+                      });
+              });
+      };
+    }
+    #endregion
+
+    #region 鈻� 鍒濆鍖栧垵濮嬫暟鎹甠____________________
+
+    /// <summary>
+    /// 鍒濆鍖栧垵濮嬫暟鎹�
+    /// </summary>
+    private void InitDefultData()
+    {
+      //鏍囬锛氬姛鑳界被鍨�
+      this.btnCaption.Text = Language.StringByID(R.MyInternationalizationString.uFunctionType);
+
+      var myFunType = this.device.DfunctionType;
+      //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛�
+      string strType = string.Empty;
+
+      if (this.device.DfunctionType == DeviceFunctionType.A涓嶆寚瀹�)
+      {
+        nowSelectNo = 0;
+      }
+      else if (this.device.DfunctionType == DeviceFunctionType.A寮�鍏�)
+      {
+        strType = Language.StringByID(R.MyInternationalizationString.uSwitch);
+        nowSelectNo = 1;
+      }
+      else if (myFunType == DeviceFunctionType.A鐏厜)
+      {
+        strType = Language.StringByID(R.MyInternationalizationString.uLight);
+        nowSelectNo = 2;
+      }
+      else if (this.device.DfunctionType == DeviceFunctionType.A鎻掑骇)
+      {
+        strType = Language.StringByID(R.MyInternationalizationString.uSocket1);
+        nowSelectNo = 3;
+      }
+
+      if (this.device.Type == DeviceType.ColorDimmableLight
+          || this.device.Type == DeviceType.ColorTemperatureLight
+          || this.device.Type == DeviceType.DimmableLight)
+      {
+        //鐏厜绫诲浐瀹氫负 鐏厜
+        var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A418");
+        strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
+        nowSelectNo = 2;
+      }
+      else if (this.device.Type == DeviceType.WindowCoveringDevice)
+      {
+        //绐楀笜鍥哄畾涓� 閬槼
+        var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A400");
+        strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
+        nowSelectNo = -1;
+      }
+      else if (this.device.Type == DeviceType.Thermostat)
+      {
+        //绌鸿皟鍥哄畾涓� 绌鸿皟
+        var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A406");
+        strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
+        nowSelectNo = -1;
+      }
+      else if (this.device.Type == DeviceType.DoorLock)
+      {
+        //闂ㄩ攣鍥哄畾涓� 闂ㄩ攣
+        var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("A405");
+        strType = infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
+        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;
+      }
+      else if (this.device.Type == DeviceType.Airer)
+      {
+        //鏅捐。鏋�
+        strType = Language.StringByID(R.MyInternationalizationString.AirerFun);
+        nowSelectNo = -1;
+      }
+      else if (device.Type == DeviceType.TemperatureSensor)
+      {
+        //鑾峰彇璁惧绫诲瀷
+        var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
+        //绌烘皵璐ㄩ噺浼犳劅鍣�
+        if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+        {
+          //绌烘皵璐ㄩ噺浼犳劅鍣� 鐜  
+          strType = Language.StringByID(R.MyInternationalizationString.Envoronment);
+          nowSelectNo = -1;
+        }
+      }
+
+      //鏄剧ず鏂囨湰
+      this.txtView.Text = strType;
+    }
+
+    #endregion
+
+    #region 鈻� 妫�娴嬭兘鍚︽樉绀篲______________________
+
+    /// <summary>
+    /// 妫�娴嬭兘鍚︽樉绀�
+    /// </summary>
+    /// <returns></returns>
+    private bool CheckCanShowRow()
+    {
+      if (this.device == null) { return true; }
+
+      if (this.device.Type == DeviceType.AirSwitch//绌烘皵寮�鍏�
+          || this.device.Type == DeviceType.ColorDimmableLight//褰╃伅
+          || this.device.Type == DeviceType.DimmableLight//璋冨厜鐏�
+          || 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.Airer//鏅捐。鏋�
+          || this.device.Type == DeviceType.ColorTemperatureLight //鑹叉俯鐏�
+          || this.device.Type == DeviceType.WindowCoveringDevice)//绐楀笜
+      {
+        return true;
+      }
+      //绌烘皵璐ㄩ噺浼犳劅鍣�
+      if (this.device.Type == DeviceType.TemperatureSensor)
+      {
+        //鑾峰彇璁惧绫诲瀷
+        var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
+        //绌烘皵璐ㄩ噺浼犳劅鍣�
+        if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
+        {
+          return true;
+        }
+      }
+
+      return false;
+    }
+
+    #endregion
+
+    #region 鈻� 鎺т欢鎽ф瘉___________________________
+
+    /// <summary>
+    /// 鎺т欢鎽ф瘉
+    /// </summary>
+    public override void RemoveFromParent()
+    {
+      this.FinishSelectEvent = null;
+
+      base.RemoveFromParent();
+    }
+
+    #endregion
+
+    #region 鈻� 涓�鑸柟娉昣__________________________
+
+    /// <summary>
+    /// 鍒锋柊璁惧鍔熻兘绫诲瀷
+    /// </summary>
+    private void RefreshDfunctionType()
+    {
+      if (this.nowSelectNo == 1)
+      {
+        this.device.DfunctionType = DeviceFunctionType.A寮�鍏�;
+        if (this.device.IsCustomizeImage == false)
+        {
+          //閲嶆柊璁剧疆鍥剧墖
+          this.device.IconPath = "Device/Switch.png";
+        }
+      }
+      else if (this.nowSelectNo == 2)
+      {
+        this.device.DfunctionType = DeviceFunctionType.A鐏厜;
+        if (this.device.IsCustomizeImage == false)
+        {
+          //閲嶆柊璁剧疆鍥剧墖
+          this.device.IconPath = "Device/Light.png";
+        }
+      }
+      else if (this.nowSelectNo == 3)
+      {
+        this.device.DfunctionType = DeviceFunctionType.A鎻掑骇;
+        if (this.device.IsCustomizeImage == false)
+        {
+          //閲嶆柊璁剧疆鍥剧墖
+          this.device.IconPath = "Device/Socket1.png";
+        }
+      }
+      else
+      {
+        this.device.DfunctionType = DeviceFunctionType.A涓嶆寚瀹�;
+        if (this.device.IsCustomizeImage == false)
+        {
+          //閲嶆柊璁剧疆鍥剧墖
+          if (this.device.Type == DeviceType.AirSwitch)
+          {
+            //绌烘皵寮�鍏�
+            this.device.IconPath = "Device/Switch.png";
+          }
+          else if (this.device.Type == DeviceType.OnOffOutput)
+          {
+            //缁х數鍣�
+            this.device.IconPath = "Device/RelayEpoint.png";
+          }
+        }
+      }
+      this.device.ReSave();
+    }
+
+    #endregion
+
+    #region 鈻� 璇诲彇璁惧鍔熻兘绫诲瀷___________________
+
+    /// <summary>
+    /// 璇诲彇璁惧鍔熻兘绫诲瀷
+    /// </summary>
+    private void ReadDeviceFunctionType()
+    {
+      HdlThreadLogic.Current.RunThread(() =>
+      {
+        //璇诲彇璁惧鍔熻兘绫诲瀷
+        var info = Common.LocalDevice.Current.ReadDeviceEpointDeviceInfo(this.device);
+        if (info != null && ((int)this.device.DfunctionType) != info.FunctionType)
+        {
+          this.device.DfunctionType = (DeviceFunctionType)info.FunctionType;
+          HdlThreadLogic.Current.RunMain(() =>
+                {
+                  //鍒锋柊鎺т欢
+                  this.InitDefultData();
+                  //鍒锋柊璁惧鍔熻兘绫诲瀷
+                  this.RefreshDfunctionType();
+                });
+        }
+      });
+    }
+
+    #endregion
+  }
+}

--
Gitblit v1.8.0