From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 10 七月 2020 10:52:13 +0800
Subject: [PATCH] 2020-07-10-01

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 1975 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 1,376 insertions(+), 599 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
index f8540ac..c4a9f56 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs
@@ -1,269 +1,1163 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Shared.Common;
-using Shared.Phone.UserView;
-using ZigBee.Device;
-
-namespace Shared.Phone.UserCenter.Device
-{
-    /// <summary>
-    /// 缂栬緫璁惧鐨勪俊鎭�(杩欓噷淇敼鐨勬槸MAC鍚�,杩欎釜鐢婚潰浼氭洿鏀筂AC鐨勭墿鐞嗗悕瀛�)
-    /// </summary>
-    public class DeviceMacInfoEditorForm : UserCenterCommonForm, ZigBee.Common.IStatus
-    {
-        #region 鈻� 鍙橀噺澹版槑___________________________
-
-        /// <summary>
-        /// 鐢婚潰姝e父鍏抽棴鐨勫洖璋冨嚱鏁�
-        /// </summary>
-        public Action<string> ActionFormClose = null;
-        /// <summary>
-        /// 璁惧瀵硅薄
-        /// </summary>
-        private List<CommonDevice> listNewDevice = null;
-        /// <summary>
-        /// 璁剧疆绐楀笜缁翠慨妯″紡Btn
-        /// </summary>
-        private SwichControl switchBtn = null;
-        /// <summary>
-        /// 鑾峰彇寰楀埌浜嗛暅鍍忎俊鎭�
-        /// </summary>
-        private bool receiveImageInfo = false;
+锘縰sing System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Shared.Common;
+using ZigBee.Device;
 
-        #endregion
+namespace Shared.Phone.UserCenter.Device
+{
+    /// <summary>
+    /// 缂栬緫璁惧鐨勪俊鎭�(杩欓噷淇敼鐨勬槸MAC鍚�,杩欎釜鐢婚潰浼氭洿鏀筂AC鐨勭墿鐞嗗悕瀛�)
+    /// </summary>
+    public class DeviceMacInfoEditorForm : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 璁惧瀵硅薄
+        /// </summary>
+        private List<CommonDevice> listNewDevice = null;
+        /// <summary>
+        /// 鍒楄〃鎺т欢
+        /// </summary>
+        private FrameListControl listview = null;
+        /// <summary>
+        /// 璁惧鐨勮澶囩被鍨�
+        /// </summary>
+        private HashSet<DeviceType> listDeviceType = new HashSet<DeviceType>();
+        /// <summary>
+        /// 璁惧鍏蜂綋绫诲瀷鐨勪俊鎭�
+        /// </summary>
+        private DeviceEnumInfo deviceEnumInfo = null;
+        /// <summary>
+        /// 涓ぎ绌鸿皟鐨勭増鏈帶浠�
+        /// </summary>
+        private NormalViewControl btnAirConditionerVersion = null;
+
+        #endregion
 
         #region 鈻� 鍒濆鍖朹____________________________
 
-        /// <summary>
-        /// 鏋勯�犳柟娉�
-        /// </summary>
-        public DeviceMacInfoEditorForm()
-        {
-            ZbGateway.StatusList.Add(this);
-        }
-
         /// <summary>
         /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
         /// </summary>
-        /// <param name="listdevices">璁惧鍒楄〃</param>
-        public void ShowForm(List<CommonDevice> listdevices)
-        {
-            this.listNewDevice = listdevices;
-
-            //璁剧疆鏍囬淇℃伅
-            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceInfo));
-
-            //鍒濆鍖栧垹闄よ澶囩殑鐣岄潰(鍙充笂)
-            this.InitDeleteDeviceForm();
-
-            new System.Threading.Thread(() =>
+        /// <param name="deviceMac">璁惧mac鍦板潃</param>
+        public void ShowForm(string deviceMac)
+        {
+            this.listNewDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
+            if (listNewDevice.Count == 0)
             {
-                //閲嶆柊鑾峰彇纭欢淇℃伅
-                this.RefreshHardFirmwareInfo();
-                Application.RunOnMainThread(() =>
-                {
-                    //鍒濆鍖栦腑閮ㄦ帶浠�
-                    this.InitMiddleFrame();
-                });
-            })
-            { IsBackground = true }.Start();
-        }
-
-        /// <summary>
-        /// 鍒濆鍖栦腑閮ㄦ帶浠�
-        /// </summary>
-        private void InitMiddleFrame()
-        {
-            this.bodyFrameLayout.RemoveAll();
-
-            //璁惧鍥剧墖
-            var btnpictrue = new PicViewControl(510, 320);
-            btnpictrue.Gravity = Gravity.CenterHorizontal;
-            btnpictrue.Y = Application.GetRealHeight(100);
-            Common.LocalDevice.Current.SetRealDeviceIconToControl(btnpictrue, listNewDevice);
-            bodyFrameLayout.AddChidren(btnpictrue);
-
-            var listview = new VerticalScrolViewLayout();
-            listview.Y = btnpictrue.Bottom + Application.GetRealHeight(100);
-            listview.Height = bodyFrameLayout.Height - btnpictrue.Bottom - Application.GetRealHeight(100);
-            bodyFrameLayout.AddChidren(listview);
-
-            //鐢熶骇鍟嗗悕绉�
-            var row = new RowLayout();
-            row.Height = ControlCommonResourse.ListViewRowHeight;
-            listview.AddChidren(row);
-            var btnManuView = new RowTopGrayView(false);
-            btnManuView.TextID = R.MyInternationalizationString.uManufacturerName;
-            row.AddChidren(btnManuView);
-            var btnManu = new RowBottomBlackView(false);
-            btnManu.Text = listNewDevice[0].ManufacturerName;
-            if (string.IsNullOrEmpty(btnManu.Text) == true)
-            {
-                if (listNewDevice[0].DriveCode > 0)
-                {
-                    //铏氭嫙璁惧鍥哄畾浣跨敤HDL
-                    listNewDevice[0].ManufacturerName = "HDL";
-                    listNewDevice[0].ReSave();
-                    btnManu.Text = "HDL";
-                }
+                //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶�
+                listNewDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac));
             }
-            row.AddChidren(btnManu);
 
-            //璁惧鍨嬪彿
-            row = new RowLayout();
-            row.Height = ControlCommonResourse.ListViewRowHeight;
-            listview.AddChidren(row);
-            var btnModelIdView = new RowTopGrayView(false);
-            btnModelIdView.TextID = R.MyInternationalizationString.uModelIdentifier;
-            row.AddChidren(btnModelIdView);
-            var btnModelId = new RowBottomBlackView(false);
-            btnModelId.Text = listNewDevice[0].ModelIdentifier;
-            row.AddChidren(btnModelId);
-
-            //搴忓垪鍙�
-            row = new RowLayout();
-            row.Height = ControlCommonResourse.ListViewRowHeight;
-            listview.AddChidren(row);
-            var btnSerialView = new RowTopGrayView(false);
-            btnSerialView.TextID = R.MyInternationalizationString.uSerialNumber;
-            row.AddChidren(btnSerialView);
-            var btnSerial = new RowBottomBlackView(false);
-            btnSerial.Text = listNewDevice[0].SerialNumber;
-            if (string.IsNullOrEmpty(btnSerial.Text) == true)
+            this.listDeviceType.Clear();
+            foreach (var device in listNewDevice)
             {
-                btnSerial.Text = listNewDevice[0].DeviceAddr;
+                //鏀堕泦璁惧绫诲瀷
+                this.listDeviceType.Add(device.Type);
             }
-            row.AddChidren(btnSerial);
+            //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑
+            this.deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listNewDevice);
 
-            //浜у搧鍚嶇О
-            string caption = Language.StringByID(R.MyInternationalizationString.uProductName);
-            string nameValue = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]);
-            var btnDeviceView = new EditorNameValueRow(caption, nameValue);
-            listview.AddChidren(btnDeviceView);
-            btnDeviceView.InitControl();
-            //璇疯緭鍏ヤ骇鍝佸悕绉�
-            btnDeviceView.SetEmptyNameTip(Language.StringByID(R.MyInternationalizationString.uProductNameMastInput));
-            //缂栬緫浜у搧鍚嶇О
-            btnDeviceView.SetDialogTitle(Language.StringByID(R.MyInternationalizationString.uEditorProductName));
-            btnDeviceView.ActionNameChangedEvent += (deviceName) =>
-            {
-                //璁惧閲嶅懡鍚嶇劧鍚庢墦寮�鏂扮殑鐢婚潰
-                this.DeviceReName(deviceName);
-            };
+            //璁剧疆鏍囬淇℃伅
+            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceSettion));
 
-            //鍙湁鏄渤涓滅殑璁惧鐨勬椂鍊�
-            if (Common.LocalDevice.Current.IsHdlDevice(listNewDevice[0]) == true)
-            {
-                //娣诲姞銆愯儗鍏夎缃�戣
-                this.AddBackLightRow(listview);
+            //鍒濆鍖栧彸涓婅鑿滃崟
+            this.InitTopRightMenu();
 
-                //娣诲姞 銆愭柟鍚戜笌闄愪綅銆戣
-                this.AddDirectionLimitRow(listview);
+            //鍒濆鍖栦腑閮ㄦ帶浠�
+            this.InitMiddleFrame();
 
-                //娣诲姞 銆愮淮鎶ゆā寮忋�戣
-                this.AddMaintenanceModeRow(listview);
-
-                //娣诲姞銆愬浐浠朵俊鎭�戣
-                this.AddFirmwareVersionRow(listview);
-            }
+            //閲嶆柊鑾峰彇纭欢淇℃伅
+            this.RefreshHardFirmwareInfo();
         }
 
-        #endregion
-
-        #region 鈻� 纭欢淇℃伅___________________________
-
         /// <summary>
-        /// 閲嶆柊鑾峰彇纭欢淇℃伅
+        /// 鍒濆鍖栦腑閮ㄦ帶浠�
         /// </summary>
-        private void RefreshHardFirmwareInfo()
+        private void InitMiddleFrame()
         {
-            //鎵撳紑杩涘害鏉�
-            this.ShowProgressBar();
+            //娓呯┖bodyFrame
+            this.ClearBodyFrame();
 
-            bool isReceive = false;
-            //閲嶆柊鑾峰彇纭欢淇℃伅
-            Common.LocalDevice.Current.SetAllHardFirmwareInfoToDevice(listNewDevice[0], true, (device, reportData) =>
+            var listBackControl = new VerticalFrameControl();
+            listBackControl.Height = bodyFrameLayout.Height;
+            bodyFrameLayout.AddChidren(listBackControl);
+
+            //鍒濆鍖栨甯�
+            var tableContr = new InformationEditorControl();
+            this.listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 1368);
+
+            //鍥剧墖
+            var btnPic = new DeviceInfoIconControl();
+            btnPic.Y = Application.GetRealHeight(92);
+            btnPic.Gravity = Gravity.CenterHorizontal;
+            listBackControl.frameTable.AddChidren(btnPic);
+            btnPic.InitControl(listNewDevice[0]);
+
+            //璁惧澶囨敞
+            string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote);
+            string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]);
+            var btnNote = new FrameCaptionInputControl(caption, deviceName, listview.rowSpace / 2);
+            listview.AddChidren(btnNote);
+            btnNote.InitControl();
+            //鍒掔嚎
+            btnNote.AddBottomLine();
+            btnNote.txtInput.FinishInputEvent += () =>
             {
-                for (int i = 1; i < listNewDevice.Count; i++)
+                string oldName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]);
+                if (btnNote.Text == string.Empty)
                 {
-                    //鍏ㄩ儴鍥炶矾鐨勪俊鎭兘鏄竴鑷寸殑
-                    DeviceAttributeLogic.Current.SetHardFirmwareInfo(device.DeviceStatusReport, listNewDevice[i]);
-                    listNewDevice[i].ReSave();
+                    btnNote.Text = oldName;
                 }
-                isReceive = true;
-            });
-            int count = 20;
-            while (isReceive == false && count > 0)
+                if (oldName != btnNote.Text)
+                {
+                    //淇敼鍚嶅瓧
+                    this.DeviceReName(btnNote.Text, false);
+                }
+            };
+
+            //璁惧绫诲瀷
+            caption = Language.StringByID(R.MyInternationalizationString.uDeviceType);
+            deviceName = Common.LocalDevice.Current.GetDeviceObjectText(listNewDevice);
+            var btnType = new FrameCaptionViewControl(caption, deviceName, listview.rowSpace / 2);
+            btnType.UseClickStatu = false;
+            listview.AddChidren(btnType);
+            btnType.InitControl();
+            //鍒掔嚎
+            btnType.AddBottomLine();
+
+            //瀹夎浣嶇疆
+            var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2);
+            listview.AddChidren(rowBeloneArea);
+            rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uInstallationLocation), this.listNewDevice);
+            //搴曠嚎
+            rowBeloneArea.AddBottomLine();
+
+            var listCheck = new List<string>();
+            rowBeloneArea.SelectRoomEvent += (roomKeys) =>
             {
-                //绛夊緟璁惧闀滃儚鐨勫弽棣�
-                System.Threading.Thread.Sleep(100);
-                count--;
-            }
-            if (count <= 0)
+                //閫夋嫨鏈垎閰嶆椂,娓呯┖
+                if (roomKeys == string.Empty) { listCheck = new List<string>(); }
+                foreach (var device in this.listNewDevice)
+                {
+                    if (device is OTADevice)
+                    {
+                        //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶�
+                        continue;
+                    }
+                    if (roomKeys == string.Empty)
+                    {
+                        //濡傛灉閫夋嫨鐨勬槸鏈垎閰嶏紝鍒欏畠鐨勫叏閮ㄥ洖璺棤鏉′欢鍏ㄩ儴娓呯┖鎴块棿
+                        HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
+                        continue;
+                    }
+                    var room = HdlRoomLogic.Current.GetRoomByDevice(device);
+                    string mainKeys = LocalDevice.Current.GetDeviceMainKeys(device);
+                    if (room == null)
+                    {
+                        //杩欓噷鏈夌偣鐗规畩,濡傛灉鍥炶矾娌℃湁璁剧疆鏈夊尯鍩熺殑鏃跺��,鎵嶈缃�
+                        listCheck.Add(mainKeys);
+                        HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
+                    }
+                    else if (this.deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir
+                      && device.Type == DeviceType.FreshAir)
+                    {
+                        //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欏尯鍩熻窡鐫�妯″潡涓�璧�
+                        HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
+                    }
+                    else if (listCheck.Contains(mainKeys) == true)
+                    {
+                        //濡傛灉杩欎釜鍥炶矾涔嬪墠閮借繕娌℃湁鍖哄煙,鍦ㄦ湰鐣岄潰杩樻病鏈夊叧闂箣鍓�,鍙互鏃犳潯浠堕殢渚垮彉鏇�
+                        HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
+                    }
+                }
+                //淇濆瓨璁惧鎴块棿绱㈠紩
+                Common.LocalDevice.Current.SaveRealDeviceRoomId(this.listNewDevice, roomKeys);
+            };
+
+            //娣诲姞鍏ㄩ儴鑿滃崟
+            this.AddAllMenuRow();
+
+            //鍒濆鍖栨甯冨畬鎴�
+            tableContr.FinishInitControl();
+            tableContr = null;
+
+            //淇濆瓨
+            var btnFinish = new BottomClickButton();
+            btnFinish.TextID = R.MyInternationalizationString.uSave;
+            bodyFrameLayout.AddChidren(btnFinish);
+            btnFinish.ButtonClickEvent += (sender, e) =>
             {
-                //绉婚櫎鑾峰彇璁惧纭欢淇℃伅鐨勭洃鍚嚎绋�
-                Common.LocalDevice.Current.RemoveDeviceHardInfoThread(listNewDevice[0]);
+                string oldName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]);
+                if (btnNote.Text.Trim() == string.Empty)
+                {
+                    btnNote.Text = oldName;
+                }
+                if (oldName != btnNote.Text.Trim())
+                {
+                    //淇敼鍚嶅瓧
+                    this.DeviceReName(btnNote.Text.Trim(), true);
+                }
+                else
+                {
+                    //鍏抽棴鑷韩
+                    this.CloseForm();
+                }
+            };
+            //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹呯殑璇�,璁╂墍鏈夎彍鍗曢兘涓嶈兘鐐瑰嚮
+            if (Common.Config.Instance.Home.IsVirtually == true)
+            {
+                for (int i = 0; i < listview.ChildrenCount; i++)
+                {
+                    var myRow = listview.GetChildren(i) as FrameRowControl;
+                    if (myRow != null)
+                    {
+                        myRow.UseClickStatu = false;
+                        myRow.CanClick = false;
+                    }
+                }
             }
-            //鍏抽棴杩涘害鏉�
-            this.CloseProgressBar();
         }
 
         #endregion
 
-        #region 鈻� 鑳屽厜璁剧疆___________________________
+        #region 鈻� 娣诲姞鑿滃崟___________________________
 
         /// <summary>
-        /// 娣诲姞銆愯儗鍏夎缃�戣
+        /// 娣诲姞鍏ㄩ儴鑿滃崟
         /// </summary>
-        /// <param name="listview"></param>
-        private void AddBackLightRow(VerticalScrolViewLayout listview)
+        private void AddAllMenuRow()
         {
-            bool canAddRow = false;
-            foreach (var device in listNewDevice)
+            if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鏅鸿兘闂ㄩ攣)
             {
-                if (device.Type == DeviceType.OnOffSwitch)
+                //鍙湁鏄渤涓滅殑璁惧鐨勬椂鍊�
+                if (deviceEnumInfo.IsHdlDevice == true)
                 {
-                    canAddRow = true;
-                    break;
+                    //娣诲姞銆愮敤鎴风鐞嗐�戣
+                    this.AddUserManageRow();
+                    //娣诲姞銆愯繙绋嬪紑閿併�戣
+                    this.AddRemoteUnLocksRow();
+                    //娣诲姞銆愰棬閿佹椂闂淬�戣
+                    this.AddDoorLocksTimeRow();
                 }
             }
-            if (canAddRow == false)
+            else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.AirConditioner_ZbGateway)
             {
-                //蹇呴』鏈変竴璺洖璺槸OnOffSwitch鎵嶈
-                return;
+                //娣诲姞銆愬鍐呮満璁剧疆銆戣(绌鸿皟涓撶敤)
+                this.AddIndoorUnitSettionRow();
             }
-
-            //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑
-            var myDeviceType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listNewDevice);
-            //濡傛灉鏄帶鍒堕潰鏉�
-            if (myDeviceType.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘 || myDeviceType.BeloneType == DeviceBeloneType.A璋冨厜鍣�)
+            else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
             {
-                //鑳屽厜璁剧疆
-                var statuRowLight = new StatuRowLayout(listview);
+                //绠�绾﹀鍔熻兘闈㈡澘
+                this.AddIBindRow();
+                this.AddFunctionSettionRow();
+                this.AddHumiditySourceRow();
+                this.AddTemperatureSensorRow();
 
-                var btnBackLight = new RowCenterView(false);
-                btnBackLight.TextID = R.MyInternationalizationString.uBackLightSettion;
-                statuRowLight.AddChidren(btnBackLight);
-                //鑳屽厜璁剧疆鍚戝彸鐨勫浘鏍�
-                statuRowLight.AddRightIconControl();
-                statuRowLight.MouseUpEvent += (sender, e) =>
+            }
+            else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment)
+            {
+                //娣诲姞銆愮粦瀹氱洰鏍囥�戣(绠�绾︾幆澧冮潰鏉跨敤) 
+                this.AddSimplePanelSettionRow();
+            }
+            else
+            {
+                //娣诲姞銆愬伐浣滄ā寮忋�戣(pir浼犳劅鍣ㄤ笓鐢�)
+                this.AddPirSensorWorkModeRow();
+                //娣诲姞銆愮粦瀹氱洰鏍囥�戣(pir浼犳劅鍣ㄤ笓鐢�)
+                this.AddPirSensorBindRow();
+                //娣诲姞銆愭柟鍚戜笌闄愪綅銆戣(寮�鍚堝笜,鍗峰笜涓撶敤)
+                this.AddDirectionAndLimitRow();
+                //娣诲姞銆愭墜鎷夋帶鍒躲�戣(寮�鍚堝笜涓撶敤)
+                this.AddHandPullControlRow();
+                //娣诲姞銆愭寜閿缃�戣(鏂规偊涓撶敤) --杩欎釜鏈夊彲鑳藉拰闈㈡澘閲嶅彔
+                if (this.AddFangyuePanelSettionRow() == false)
                 {
-                    var form = new DevicePanel.PanelBackLightSettionForm();
-                    this.AddForm(form, listNewDevice);
-                };
+                    //娣诲姞銆愭寜閿缃�戣(闈㈡澘涓撶敤)
+                    this.AddPanelSettionRow();
+                }
+                //妫�娴嬭兘鍚︽樉绀哄姛鑳借缃殑鑿滃崟
+                if (this.CheckCanShowFunctionSettionRow() == true)
+                {
+                    //娣诲姞銆愬姛鑳借缃�戣
+                    if (deviceEnumInfo.ConcreteType == DeviceConcreteType.Sensor_PMTwoPointFive)
+                    {
+                        //PM浼犳劅鍣�
+                        this.AddFunctionSettionRowPM();
+                    }
+                    else
+                    {
+                        this.AddFunctionSettionRow();
+                    }
+
+                }
+
+                //娣诲姞銆愬共鎺ョ偣璁剧疆銆戣
+                this.AddDryContactSettionRow();
+            }
+            //娣诲姞銆愬姛鑳界被鍨嬨�戣(绌烘皵寮�鍏充笓鐢�)
+            this.AddAirSwitchFunctionTypeRow();
+            //娣诲姞銆愰�氱敤淇℃伅銆戣
+            this.AddGeneralInformationRow();
+
+            //娣诲姞銆愮┖璋冩ā鍧楃増鏈�(绌鸿皟涓撶敤)銆戣
+            this.AddAirConditionerModelVersionRow();
+
+            if (deviceEnumInfo.IsHdlDevice == true)
+            {
+                //娣诲姞銆愬浐浠跺崌绾с�戣
+                this.AddFirmwareUpdateRow();
             }
         }
 
-        #endregion
+        #endregion
 
-        #region 鈻� 鍥轰欢淇℃伅___________________________
+        #region 鈻� 鐢ㄦ埛绠$悊(闂ㄩ攣)_____________________
 
         /// <summary>
-        /// 娣诲姞銆愬浐浠朵俊鎭�戣
+        /// 娣诲姞銆愮敤鎴风鐞嗐�戣锛堥棬閿佷笓鐢級
         /// </summary>
-        /// <param name="listview"></param>
-        private void AddFirmwareVersionRow(VerticalScrolViewLayout listview)
+        private void AddUserManageRow()
+        {
+            //濡傛灉鏄櫤鑳介棬閿�
+            if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鏅鸿兘闂ㄩ攣)
+            {
+                //鐢ㄦ埛绠$悊
+                string caption = Language.StringByID(R.MyInternationalizationString.uUserManage);
+                var btnRow = new FrameRowControl(listview.rowSpace / 2);
+                listview.AddChidren(btnRow);
+                btnRow.AddLeftCaption(caption, 600);
+                //鍚戝彸鍥炬爣
+                btnRow.AddRightArrow();
+                //搴曠嚎
+                btnRow.AddBottomLine();
+                var doorLock = this.listNewDevice[0] as ZigBee.Device.DoorLock;
+                btnRow.ButtonClickEvent += async (sender, e) =>
+                 {
+                     if (UserCenterResourse.UserInfo.AuthorityNo == 1)
+                     {
+                         Action action = null;
+                         Action actionNone = null;
+                         action = () =>
+                         {
+                             var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock);
+                             Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement);
+                             Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                             userManagement.Show();
+                         };
+                         actionNone = () =>
+                         {
+                             Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock);
+                         };
+                         HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone);
+                     }
+                     else
+                     {
+                         CommonPage.Loading.Start("");
+                         var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid);
+                         if (result == false)
+                         {
+                             Action action = null;
+                             Action actionNone = null;
+                             action = () =>
+                             {
+                                 var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock);
+                                 Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement);
+                                 Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                                 userManagement.Show();
+                             };
+                             actionNone = () =>
+                             {
+                                 Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock);
+                             };
+                             HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone);
+
+                         }
+                         else
+                         {
+                             this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AccountIsFreezed));
+                         }
+                         CommonPage.Loading.Hide();
+                     }
+                 };
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 杩滅▼寮�閿�(闂ㄩ攣)_____________________
+
+        /// <summary>
+        /// 娣诲姞銆愯繙绋嬪紑閿併�戣锛堥棬閿佷笓鐢級
+        /// </summary>
+        private void AddRemoteUnLocksRow()
+        {
+            //濡傛灉鏄櫤鑳介棬閿�
+            if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鏅鸿兘闂ㄩ攣)
+            {
+                //杩滅▼寮�閿�
+                string caption = Language.StringByID(R.MyInternationalizationString.uRemoteUnLocks);
+                var btnRow = new FrameRowControl(listview.rowSpace / 2);
+                btnRow.UseClickStatu = false;
+                listview.AddChidren(btnRow);
+                btnRow.AddLeftCaption(caption, 600);
+                //寮�鍏冲浘鏍�
+                var btnswitch = btnRow.AddMostRightSwitchIcon();
+                //搴曠嚎
+                btnRow.AddBottomLine();
+
+                var doorLock = (ZigBee.Device.DoorLock)listNewDevice[0];
+                if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword) == false)
+                {
+                    btnswitch.IsSelected = true;
+                }
+                //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹呯殑璇�,璁╂墍鏈夎彍鍗曢兘涓嶈兘鐐瑰嚮
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    btnswitch.CanClick = false;
+                }
+
+                btnswitch.ButtonClickEvent += async (sender, e) =>
+                 {
+                     if (UserCenterResourse.UserInfo.AuthorityNo == 1)
+                     {
+                         if (btnswitch.IsSelected == true)
+                         {
+                             btnswitch.IsSelected = false;
+                             doorLock.RemoteUnlockPassword = string.Empty;
+                             return;
+                         }
+                         var frame = new DoorLock.DoorLockCommonLayout();
+                         frame.RemotePasswordDialog((ZigBee.Device.DoorLock)listNewDevice[0], btnswitch.btnIcon);
+                         frame = null;
+                     }
+                     else
+                     {
+                         var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid);
+                         if (result == false)
+                         {
+                             var result1 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockUnlockAccess(doorLock, Shared.Common.Config.Instance.Guid);
+                             if (result1 == true)
+                             {
+                                 if (btnswitch.IsSelected == true)
+                                 {
+                                     btnswitch.IsSelected = false;
+                                     doorLock.RemoteUnlockPassword = string.Empty;
+                                     return;
+                                 }
+                                 var frame = new DoorLock.DoorLockCommonLayout();
+                                 frame.RemotePasswordDialog((ZigBee.Device.DoorLock)listNewDevice[0], btnswitch.btnIcon);
+                                 frame = null;
+                             }
+                             else
+                             {
+                                 this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NoAccess));
+                             }
+                         }
+                         else
+                         {
+                             this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AccountIsFreezed));
+                         }
+                     }
+                 };
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 闂ㄩ攣鏃堕棿(闂ㄩ攣)_____________________
+
+        /// <summary>
+        /// 娣诲姞銆愰棬閿佹椂闂淬�戣锛堥棬閿佷笓鐢級
+        /// </summary>
+        private void AddDoorLocksTimeRow()
+        {
+            //濡傛灉鏄櫤鑳介棬閿�
+            if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鏅鸿兘闂ㄩ攣)
+            {
+                //闂ㄩ攣鏃堕棿
+                string caption = Language.StringByID(R.MyInternationalizationString.uDoorLocksTime);
+                var btnRow = new FrameRowControl(listview.rowSpace / 2);
+                listview.AddChidren(btnRow);
+                btnRow.AddLeftCaption(caption, 600);
+                //鍚戝彸鍥炬爣
+                btnRow.AddRightArrow();
+                //搴曠嚎
+                btnRow.AddBottomLine();
+                var doorLock = this.listNewDevice[0] as ZigBee.Device.DoorLock;
+                btnRow.ButtonClickEvent += async (sender, e) =>
+                 {
+                     if (UserCenterResourse.UserInfo.AuthorityNo == 1)
+                     {
+                         var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "DoorLockTime");
+                         Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage);
+                         Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                         tempPage.Show();
+                     }
+                     else
+                     {
+                         var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid);
+                         if (result == false)
+                         {
+                             var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "DoorLockTime");
+                             Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage);
+                             Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                             tempPage.Show();
+                         }
+                         else
+                         {
+                             this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AccountIsFreezed));
+                         }
+                     }
+                 };
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 鎸夐敭璁剧疆(闈㈡澘)_____________________
+
+        /// <summary>
+        /// 娣诲姞銆愭寜閿缃�戣(闈㈡澘)
+        /// </summary>
+        private void AddPanelSettionRow()
+        {
+            //蹇呴』鏄渤涓滆澶�,蹇呴』鏄潰鏉匡紝骞朵笖鏈夊共鎺ョ偣鎵嶈
+            if (deviceEnumInfo.IsHdlDevice == false || deviceEnumInfo.BeloneType != DeviceBeloneType.A鎸夐敭闈㈡澘 || listDeviceType.Contains(DeviceType.OnOffSwitch) == false)
+            {
+                return;
+            }
+            //鎸夐敭璁剧疆
+            string caption = Language.StringByID(R.MyInternationalizationString.uPanelSettion);
+            var btnFunction = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnFunction);
+            btnFunction.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            btnFunction.AddRightArrow();
+            //搴曠嚎
+            btnFunction.AddBottomLine();
+            btnFunction.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new DevicePanel.PanelButtonSettionForm();
+                form.AddForm(listNewDevice[0]);
+            };
+        }
+
+        #region 鈻� 绠�绾︾幆澧�(闈㈡澘)_____________________
+
+        /// <summary>
+        /// 娣诲姞銆愭寜閿缃�戣绠�绾︾幆澧�(闈㈡澘)
+        /// </summary>
+        private void AddSimplePanelSettionRow()
+        {
+            //鎸夐敭璁剧疆
+            string caption = Language.StringByID(R.MyInternationalizationString.uPanelSettion);
+            var btnFunction = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnFunction);
+            btnFunction.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            btnFunction.AddRightArrow();
+            //搴曠嚎
+            btnFunction.AddBottomLine();
+            btnFunction.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new DeviceBind.PanelSimpleEnvironmentTargetsForm();
+
+            };
+        }
+
+        #endregion
+		
+        #endregion
+
+        #region 鈻� 鎸夐敭璁剧疆(鏂规偊)_____________________
+
+        /// <summary>
+        /// 娣诲姞銆愭寜閿缃�戣(鏂规偊)
+        /// </summary>
+        private bool AddFangyuePanelSettionRow()
+        {
+            if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueTwo
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFour
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEight
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
+            {
+                //鎸夐敭璁剧疆
+                string caption = Language.StringByID(R.MyInternationalizationString.uPanelSettion);
+                var btnFunction = new FrameRowControl(listview.rowSpace / 2);
+                listview.AddChidren(btnFunction);
+                btnFunction.AddLeftCaption(caption, 600);
+                //鍚戝彸鍥炬爣
+                btnFunction.AddRightArrow();
+                //搴曠嚎
+                btnFunction.AddBottomLine();
+                btnFunction.ButtonClickEvent += (sender, e) =>
+                {
+                    if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueTwo
+                    || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFour
+                    || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEight)
+                    {
+                        //鏂规偊鎸夐敭闈㈡澘[鍗曞紑鍙屾帶/鍙屽紑鍥涙帶/鍥涘紑鍏帶]閰嶇疆
+                        var form = new DevicePanel.PanelFangyueButtonSettionForm();
+                        form.AddForm(listNewDevice[0]);
+                    }
+                    else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment)
+                    {
+                        //鏂规偊鐜闈㈡澘鐨勬寜閿厤缃�
+                        var form = new DevicePanel.PanelFangyueEnvironmentButtonSettionForm();
+                        form.AddForm(listNewDevice[0]);
+                    }
+                    else
+                    {
+                        //鏂规偊鏂伴闈㈡澘鐨勬寜閿厤缃�
+                        var form = new DevicePanel.PanelFangyueFreshAirButtonSettionForm();
+                        form.AddForm(listNewDevice[0]);
+                    }
+                };
+                return true;
+            }
+            return false;
+        }
+
+        #endregion
+
+        #region 鈻� 骞叉帴鐐硅缃�(骞叉帴鐐�)_________________
+
+        /// <summary>
+        /// 娣诲姞銆愬共鎺ョ偣璁剧疆銆戣
+        /// </summary>
+        private void AddDryContactSettionRow()
+        {
+            if (this.listDeviceType.Contains(DeviceType.OnOffSwitch) == false)
+            {
+                //蹇呴』鏈変竴璺洖璺槸OnOffSwitch鎵嶈,闈㈡澘鐨勫共鎺ョ偣鐨勮瘽锛屼娇鐢ㄧ殑鏄埆鐨勮彍鍗�
+                return;
+            }
+            if (deviceEnumInfo.IsHdlDevice == true && deviceEnumInfo.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘)
+            {
+                //娌充笢鐨勯潰鏉跨殑璇濓紝瀹冩湁鑷繁鐨勯厤缃晫闈�,
+                //濡傛灉鏄涓夋柟璁惧鐨勮瘽锛屼娇鐢ㄦ櫘閫氬共鎺ョ偣鐣岄潰(瀹冭兘浣跨敤缁戝畾鍔熻兘,鏃犺儗鍏夎缃�)
+                return;
+            }
+
+            //骞叉帴鐐硅缃�
+            string caption = Language.StringByID(R.MyInternationalizationString.uDryContactSettion);
+            var btnBackLight = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnBackLight);
+            btnBackLight.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            btnBackLight.AddRightArrow();
+            //搴曠嚎
+            btnBackLight.AddBottomLine();
+            btnBackLight.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new DeviceDryContactSettionForm();
+                form.AddForm(listNewDevice[0]);
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 宸ヤ綔妯″紡(pir浼犳劅鍣ㄤ笓鐢�)____________
+
+        /// <summary>
+        /// 娣诲姞銆愬伐浣滄ā寮忋�戣(pir浼犳劅鍣ㄤ笓鐢�)
+        /// </summary>
+        private void AddPirSensorWorkModeRow()
+        {
+            if (this.deviceEnumInfo.ConcreteType != DeviceConcreteType.Sensor_Pir
+                || deviceEnumInfo.IsHdlDevice == false)
+            {
+                return;
+            }
+            //宸ヤ綔妯″紡
+            string caption = Language.StringByID(R.MyInternationalizationString.uWorkMode);
+            var btnFunction = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnFunction);
+            btnFunction.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            btnFunction.AddRightArrow();
+            //搴曠嚎
+            btnFunction.AddBottomLine();
+            btnFunction.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new DevicePirSensor.PirSensorWorkModeMenuForm();
+                form.AddForm((IASZone)this.listNewDevice[0]);
+            };
+        }
+
+        #endregion;
+
+        #region 鈻� 缁戝畾鐩爣(pir浼犳劅鍣ㄤ笓鐢�)____________
+
+        /// <summary>
+        /// 娣诲姞銆愮粦瀹氱洰鏍囥�戣(pir浼犳劅鍣ㄤ笓鐢�)
+        /// </summary>
+        private void AddPirSensorBindRow()
+        {
+            if (this.deviceEnumInfo.ConcreteType != DeviceConcreteType.Sensor_Pir)
+            {
+                return;
+            }
+            //缁戝畾鐩爣
+            string caption = Language.StringByID(R.MyInternationalizationString.uBindTargets);
+            var btnFunction = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnFunction);
+            btnFunction.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            btnFunction.AddRightArrow();
+            //搴曠嚎
+            btnFunction.AddBottomLine();
+            btnFunction.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new DevicePirSensor.PirSensorBindTargetSettionForm();
+                form.AddForm((IASZone)this.listNewDevice[0]);
+            };
+        }
+
+        #endregion;
+
+        #region 鈻� 鍔熻兘璁剧疆(閫氱敤)_____________________
+
+        /// <summary>
+        /// 娣诲姞銆愬姛鑳借缃�戣
+        /// </summary>
+        private void AddFunctionSettionRow()
+        {
+            //鍙湁鍥炶矾鏁板ぇ浜�1鎵嶈兘鏈夎繖涓彍鍗�
+            if (Common.LocalDevice.Current.GetDevicesCountByMac(listNewDevice[0].DeviceAddr) == 1)
+            {
+                //鏂伴灏忔ā鍧楀彧鏈変竴涓洖璺紝浣嗚姹傛柊椋庡皬妯″潡鐨勬柊椋庢湁鍔熻兘璁剧疆
+                if (deviceEnumInfo.ConcreteType != DeviceConcreteType.Relay_FangyueFreshAirModul)
+                {
+                    return;
+                }
+            }
+            if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
+            {
+                //鐜闈㈡澘娌℃湁鍔熻兘璁剧疆
+                return;
+            }
+
+            //2020.03.06鏂拌拷鍔狅細濡傛灉鍏ㄩ儴閮芥槸骞叉帴鐐圭殑璇�,涔熶笉鑳芥湁杩欎釜涓滆タ
+            int dryContactCount = 0;
+            for (int i = 0; i < listNewDevice.Count; i++)
+            {
+                if (listNewDevice[i].Type == DeviceType.OnOffSwitch)
+                {
+                    dryContactCount++;
+                }
+            }
+            if (listNewDevice.Count == dryContactCount)
+            {
+                //杩欎釜璁惧鍏ㄦ槸骞叉帴鐐�
+                return;
+            }
+
+            //鍔熻兘璁剧疆
+            string caption = Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp);
+            var btnFunction = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnFunction);
+            btnFunction.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            btnFunction.AddRightArrow();
+            //搴曠嚎
+            btnFunction.AddBottomLine();
+            btnFunction.ButtonClickEvent += (sender, e) =>
+            {
+                //鏂规偊闈㈡澘
+                if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueTwo
+                    || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFour
+                    || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEight)
+                {
+                    var form = new DevicePanel.PanelFangyueFunctionSettionForm();
+                    form.AddForm(listNewDevice[0], deviceEnumInfo);
+                }
+                //娌充笢鐨勯潰鏉胯澶�
+                else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘 && deviceEnumInfo.IsHdlDevice == true)
+                {
+                    var form = new DevicePanel.PanelFunctionSettionForm();
+                    form.AddForm(listNewDevice[0]);
+                }
+                else
+                {
+                    var form = new DeviceFunctionSettionForm();
+                    form.AddForm(listNewDevice[0], false);
+                }
+            };
+        }
+
+        /// <summary>
+        /// 娣诲姞浼犳劅鍣ㄣ�愬姛鑳借缃�戣
+        /// </summary>
+        private void AddFunctionSettionRowPM()
+        {
+            //鍔熻兘璁剧疆
+            string caption = Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp);
+            var btnFunction = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnFunction);
+            btnFunction.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            btnFunction.AddRightArrow();
+            //搴曠嚎
+            btnFunction.AddBottomLine();
+            btnFunction.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new DeviceFunctionSettionForm();
+                form.AddForm(listNewDevice[0], false);
+            };
+        }
+
+        #endregion;
+
+        #region 鈻� 鏂瑰悜涓庨檺浣�(绐楀笜)___________________
+
+        /// <summary>
+        /// 娣诲姞銆愭柟鍚戜笌闄愪綅銆戣(绐楀笜涓撶敤)
+        /// </summary>
+        private void AddDirectionAndLimitRow()
+        {
+            if (deviceEnumInfo.BeloneType != DeviceBeloneType.A绐楀笜)
+            {
+                return;
+            }
+            var deviceCurtain = (Rollershade)this.listNewDevice[0];
+            if (deviceCurtain.WcdType != 4 && deviceCurtain.WcdType != 0)
+            {
+                //寮�鍚堝笜,鍗峰笜涓撶敤
+                return;
+            }
+
+            //鏂瑰悜涓庨檺浣�
+            string caption = Language.StringByID(R.MyInternationalizationString.uDirectionAndLimit);
+            var btnFunction = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnFunction);
+            btnFunction.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            btnFunction.AddRightArrow();
+            //搴曠嚎
+            btnFunction.AddBottomLine();
+            btnFunction.ButtonClickEvent += (sender, e) =>
+            {
+                if (deviceCurtain.WcdType == 4)
+                {
+                    var form = new DeviceCurtain.AutoOpenDirectionAndLimitSettionForm();
+                    form.AddForm(deviceCurtain);
+                }
+                else if (deviceCurtain.WcdType == 0)
+                {
+                    var form = new DeviceCurtain.SiphonateDirectionAndLimitSettionForm();
+                    form.AddForm(deviceCurtain);
+                }
+            };
+        }
+
+        #endregion;
+
+        #region 鈻� 鎵嬫媺鎺у埗(寮�鍚堝笜)___________________
+
+        /// <summary>
+        /// 娣诲姞銆愭墜鎷夋帶鍒躲�戣(寮�鍚堝笜涓撶敤)
+        /// </summary>
+        private void AddHandPullControlRow()
+        {
+            if (deviceEnumInfo.BeloneType != DeviceBeloneType.A绐楀笜)
+            {
+                return;
+            }
+            var deviceCurtain = (Rollershade)this.listNewDevice[0];
+            if (deviceCurtain.WcdType != 4)
+            {
+                //寮�鍚堝笜涓撶敤
+                return;
+            }
+
+            //鎵嬫媺鎺у埗
+            string caption = Language.StringByID(R.MyInternationalizationString.uHandPullControl);
+            var btnFunction = new FrameRowControl(listview.rowSpace / 2);
+            btnFunction.UseClickStatu = false;
+            listview.AddChidren(btnFunction);
+            btnFunction.AddLeftCaption(caption, 600);
+            //寮�鍏冲浘鏍�
+            var btnSwitch = btnFunction.AddMostRightSwitchIcon();
+            //搴曠嚎
+            btnFunction.AddBottomLine();
+            btnSwitch.ButtonClickEvent += (sender, e) =>
+            {
+                //鍒囨崲妯″紡
+                bool statu = !btnSwitch.IsSelected;
+                var result = HdlDeviceCurtainLogic.Current.SetHandPullControl(deviceCurtain, statu);
+                if (result == true)
+                {
+                    btnSwitch.IsSelected = statu;
+                }
+            };
+            //濡傛灉鏄櫄鎷熶綇瀹�
+            if (Common.Config.Instance.Home.IsVirtually == true)
+            {
+                btnSwitch.IsSelected = ModelData.DeviceModelDataLogic.Current.GetCurtainHandPullControl(deviceCurtain);
+                return;
+            }
+
+            //娣诲姞灞炴�т笂鎶ョ洃鍚�
+            string mainkeys = LocalDevice.Current.GetDeviceMainKeys(this.listNewDevice[0]);
+            HdlGatewayReceiveLogic.Current.AddAttributeEvent("HandPullControl", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (device) =>
+            {
+                string checkKey = LocalDevice.Current.GetDeviceMainKeys(device);
+                if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258)
+                {
+                    return;
+                }
+                foreach (var attriBute in device.DeviceStatusReport.AttriBute)
+                {
+                    if (attriBute.AttributeId == 23)
+                    {
+                        //鎵嬫媺鎺у埗
+                        if (0 < (attriBute.AttriButeData & 0x04))
+                        {
+                            HdlThreadLogic.Current.RunMain(() =>
+                            {
+                                btnSwitch.IsSelected = true;
+                            });
+                        }
+                    }
+                }
+            });
+            //鍙戦�佸懡浠�
+            deviceCurtain.ReadCurtainDirectionAndMode();
+        }
+
+        #endregion;
+
+        #region 鈻� 瀹ゅ唴鏈鸿缃�(绌鸿皟)___________________
+
+        /// <summary>
+        /// 娣诲姞銆愬鍐呮満璁剧疆銆戣(绌鸿皟涓撶敤)
+        /// </summary>
+        private void AddIndoorUnitSettionRow()
+        {
+            if (this.deviceEnumInfo.ConcreteType != DeviceConcreteType.AirConditioner_ZbGateway
+                || this.listNewDevice[0] is OTADevice)//杩藉姞锛氬崟绾彧鏈�200绔偣鐨勮瘽锛屼笉鏄剧ず杩欎釜鑿滃崟
+            {
+                return;
+            }
+
+            //瀹ゅ唴鏈鸿缃�
+            string caption = Language.StringByID(R.MyInternationalizationString.uIndoorUnitSettion);
+            var btnFunction = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnFunction);
+            btnFunction.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            btnFunction.AddRightArrow();
+            //搴曠嚎
+            btnFunction.AddBottomLine();
+            btnFunction.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new DeviceAirConditioner.IndoorUnitListForm();
+                form.AddForm(listNewDevice[0].DeviceAddr);
+            };
+        }
+        #endregion
+
+        #region 鈻�  绠�绾﹀鍔熻兘闈㈡澘鐢╛__________________
+        /// <summary>
+        /// 娣诲姞銆愮粦瀹氱洰鏍囥�戣 
+        /// </summary>
+        private void AddIBindRow()
+        {
+            string bindTargets = Language.StringByID(R.MyInternationalizationString.uBindTargets);
+            var btnBindTargets = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnBindTargets);
+            btnBindTargets.AddLeftCaption(bindTargets, 600);
+            //鍚戝彸鍥炬爣
+            btnBindTargets.AddRightArrow();
+            //搴曠嚎
+            btnBindTargets.AddBottomLine();
+            btnBindTargets.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new DeviceBind.PanelSimpleMutilfunctionTargetsForm();
+            };
+        }
+
+        /// <summary>
+        ///  婀垮害鏉ユ簮琛�
+        /// </summary>
+        private void AddHumiditySourceRow()
+        {
+            //婀垮害
+            var rowHumidity = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(rowHumidity);
+            rowHumidity.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.HumiditySource), 600);
+            //搴曠嚎
+            rowHumidity.AddBottomLine();
+            //鍙崇澶�
+            rowHumidity.AddRightArrow();
+            var msg = Language.StringByID(R.MyInternationalizationString.nothing);
+            //if (!string.IsNullOrEmpty(bindHumidityName))
+            //{
+            //    msg = bindHumidityName;
+            //}
+            var btnHumidityStatu = rowHumidity.AddMostRightView(msg, 700);
+            rowHumidity.ButtonClickEvent += (sender, e) =>
+            {
+                //var key = new Panel();
+                //var bindHumiditySensorPage = new Shared.Phone.UserCenter.DeviceBind.PanelSimpleMutilfunctionBindSensorForm(key, bindHumidityDev, 3);
+                //Shared.Phone.UserView.HomePage.Instance.AddChidren(bindHumiditySensorPage);
+                //Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                //bindHumiditySensorPage.Show();
+
+                //bindHumiditySensorPage.actionHumidityTarget += (bindName) =>
+                //{
+                //    Application.RunOnMainThread(() =>
+                //    {
+                //        if (string.IsNullOrEmpty(bindName))
+                //        {
+                //            btnHumidityStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing);
+                //        }
+                //        else
+                //        {
+                //            btnHumidityStatu.Text = bindName;
+                //        }
+                //    });
+                //};
+            };
+        }
+
+        /// <summary>
+        ///  娓╁害鏉ユ簮琛�
+        /// </summary>
+        private void AddTemperatureSensorRow()
+        {
+            //娓╁害鏉ユ簮
+            var rowTemPerature = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(rowTemPerature);
+            rowTemPerature.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.TemperatureSource), 600);
+            //搴曠嚎
+            rowTemPerature.AddBottomLine();
+            //鍙崇澶�
+            rowTemPerature.AddRightArrow();
+            var msg = Language.StringByID(R.MyInternationalizationString.nothing);
+            //if (!string.IsNullOrEmpty(bindTemperatureName))
+            //{
+            //    msg = bindTemperatureName;
+            //}
+            var btnTemperatureStatu = rowTemPerature.AddMostRightView(msg, 700);
+            rowTemPerature.ButtonClickEvent += (sender, e) =>
+            {
+                //var key = new Panel();
+                //var bindTemperatureSensorPage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(key, bindTemperatureDev, 2);
+                //Shared.Phone.UserView.HomePage.Instance.AddChidren(bindTemperatureSensorPage);
+                //Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                //bindTemperatureSensorPage.Show();
+
+                //bindTemperatureSensorPage.actionTemperatureTarget += (bindName) =>
+                //{
+                //    Application.RunOnMainThread(() =>
+                //    {
+                //        if (string.IsNullOrEmpty(bindName))
+                //        {
+                //            btnTemperatureStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing);
+                //        }
+                //        else
+                //        {
+                //            btnTemperatureStatu.Text = bindName;
+                //        }
+                //    });
+                //};
+            };
+        }
+        #endregion
+
+        #region 鈻� 鍔熻兘绫诲瀷(绌烘皵寮�鍏充笓鐢�)_____________
+
+        /// <summary>
+        /// 娣诲姞銆愬姛鑳界被鍨嬨�戣(绌烘皵寮�鍏充笓鐢�)
+        /// </summary>
+        private void AddAirSwitchFunctionTypeRow()
+        {
+            //2020.04.28鍙樻洿:鏈変釜鍒澶囧畠闄や簡缁х數鍣ㄥ洖璺紝浠�涔堥兘娌℃湁浜�,
+            //杩欎釜鏃跺�欎篃瑕佺幇瀹炲嚭鏉�
+            if (this.listNewDevice.Count != 1)
+            {
+                return;
+            }
+            if (this.listNewDevice[0].Type != DeviceType.OnOffOutput
+                && this.listNewDevice[0].Type != DeviceType.AirSwitch)
+            {
+                return;
+            }
+            //鑷畾涔夊姛鑳界被鍨嬫帶浠�
+            var rowFunction = new DeviceFunctionTypeRowControl(this.listNewDevice[0], listview.rowSpace / 2);
+            listview.AddChidren(rowFunction);
+            rowFunction.InitControl();
+            //搴曠嚎
+            rowFunction.AddBottomLine();
+        }
+
+        #endregion
+
+        #region 鈻� 閫氱敤淇℃伅___________________________
+
+        /// <summary>
+        /// 娣诲姞銆愰�氱敤淇℃伅銆戣
+        /// </summary>
+        private void AddGeneralInformationRow()
+        {
+            string caption = Language.StringByID(R.MyInternationalizationString.uGeneralInformation);
+            var btnGeneral = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(btnGeneral);
+            btnGeneral.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            btnGeneral.AddRightArrow();
+            //搴曠嚎
+            btnGeneral.AddBottomLine();
+            btnGeneral.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new DeviceGeneralInformationForm();
+                form.AddForm(listNewDevice[0].DeviceAddr);
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 绌鸿皟妯″潡鐗堟湰(绌鸿皟涓撶敤)_____________
+
+        /// <summary>
+        /// 娣诲姞銆愮┖璋冩ā鍧楃増鏈�戣(娌充笢鐨勪腑澶┖璋�)
+        /// </summary>
+        private void AddAirConditionerModelVersionRow()
+        {
+            if (this.deviceEnumInfo.ConcreteType != DeviceConcreteType.AirConditioner_ZbGateway)
+            {
+                //涓嶆槸涓ぎ绌鸿皟
+                return;
+            }
+            string caption = Language.StringByID(R.MyInternationalizationString.uAirConditionerModelVersion);
+            var rowVersion = new FrameRowControl(listview.rowSpace / 2);
+            rowVersion.UseClickStatu = false;
+            listview.AddChidren(rowVersion);
+            rowVersion.AddLeftCaption(caption, 600);
+            //鐗堟湰
+            this.btnAirConditionerVersion = rowVersion.AddMostRightView("", 800);
+            //搴曠嚎
+            rowVersion.AddBottomLine();
+
+            //鑾峰彇涓ぎ绌鸿皟妯″潡鐨勭増鏈�
+            this.ReadAirConditionerVersion();
+        }
+
+        #endregion
+
+        #region 鈻� 鍥轰欢鍗囩骇___________________________
+
+        /// <summary>
+        /// 娣诲姞銆愬浐浠跺崌绾с�戣
+        /// </summary>
+        private void AddFirmwareUpdateRow()
         {
             //鎷ユ湁200绔彛杩欎釜涓滆タ鐨勬椂鍊欙紝鎵嶄細鏄剧ず杩欎竴琛�
             var oTADevice = Common.LocalDevice.Current.GetOTADevice(listNewDevice[0].DeviceAddr);
@@ -272,27 +1166,47 @@
                 return;
             }
 
-            var statuRow = new StatuRowLayout(listview);
-            //鍥轰欢淇℃伅
-            var btnUpview = new RowCenterView(false);
-            btnUpview.TextID = R.MyInternationalizationString.uFirmwareInformation;
-            statuRow.AddChidren(btnUpview);
+            //鍥轰欢鍗囩骇
+            string caption = Language.StringByID(R.MyInternationalizationString.uFirmwareUpdate);
+            var rowUpDate = new FrameRowControl(listview.rowSpace / 2);
+            listview.AddChidren(rowUpDate);
+            rowUpDate.AddLeftCaption(caption, 600);
+            //鍚戝彸鍥炬爣
+            rowUpDate.AddRightArrow();
+            //搴曠嚎
+            rowUpDate.AddBottomLine();
+
             //鎻愮ず鏈夋柊鐗堟湰
-            var btnNewVersion = new RowNewVersionTipView();
+            var btnNewVersion = new PicViewControl(78, 55);
+            btnNewVersion.UnSelectedImagePath = "Item/NewVersion.png";
             btnNewVersion.Visible = false;
-            statuRow.AddChidren(btnNewVersion);
+            btnNewVersion.X = Application.GetRealWidth(242);
+            btnNewVersion.Y = Application.GetRealHeight(23);
+            rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEvent);
 
-            statuRow.AddRightIconControl();
-
-            statuRow.MouseUpEvent += (sender, e) =>
+            rowUpDate.ButtonClickEvent += (sender, e) =>
             {
+                if (this.deviceEnumInfo.ConcreteType != DeviceConcreteType.AirConditioner_ZbGateway)
+                {
+                    //杩欎釜鏄竴鑸澶囩殑鍗囩骇
+                    var form = new DeviceFirmwareUpdateForm();
+                    form.AddForm(listNewDevice[0].DeviceAddr);
+                }
+                else
+                {
+                    //涓ぎ绌鸿皟鐨勫崌绾х殑璇濓紝鏄壒娈婄殑
+                    var form = new DeviceAirConditioner.ACZbGatewayUpdateMenuForm();
+                    form.AddForm(listNewDevice[0], btnNewVersion.Visible);
+                }
                 btnNewVersion.Visible = false;
-                var form = new DeviceFirmwareInfoForm();
-                this.AddForm(form, listNewDevice);
             };
 
-            //璁剧疆璁惧鐨勭増鏈俊鎭�
-            this.SetDeviceVersionInfo(btnNewVersion, oTADevice);
+            //濡傛灉褰撳墠浣忓畢涓嶆槸铏氭嫙浣忓畢
+            if (Common.Config.Instance.Home.IsVirtually == false)
+            {
+                //璁剧疆璁惧鐨勭増鏈俊鎭�
+                this.SetDeviceVersionInfo(btnNewVersion, oTADevice);
+            }
         }
 
         /// <summary>
@@ -300,418 +1214,281 @@
         /// </summary>
         /// <param name="btnNewVersion">鏈夋柊鐗堟湰鐨勬彁绀烘帶浠�</param>
         /// <param name="oTADevice">ota璁惧</param>
-        private void SetDeviceVersionInfo(RowNewVersionTipView btnNewVersion, OTADevice oTADevice)
+        private void SetDeviceVersionInfo(PicViewControl btnNewVersion, OTADevice oTADevice)
         {
-            new System.Threading.Thread(async () =>
+            HdlThreadLogic.Current.RunThread(async () =>
             {
+                bool receiveImageInfo = false;
                 //璁剧疆璁惧鍏ㄩ儴鐨勯暅鍍忎俊鎭�
-                Common.LocalDevice.Current.SetAllImageInfoToOtaDevice(oTADevice, this.OtaImageInfoActionBack);
+                HdlDeviceImageInfoLogic.Current.SetAllImageInfoToOtaDevice(oTADevice, (device, reportData) =>
+                {
+                    receiveImageInfo = true;
+                });
                 int count = 5;
-                while (this.receiveImageInfo == false && count > 0)
+                while (receiveImageInfo == false && count > 0)
                 {
                     //绛夊緟璁惧闀滃儚鐨勫弽棣�
                     await Task.Delay(300);
                     count--;
                 }
-                //鍙橀噺杩樺師 
-                this.receiveImageInfo = false;
+                //绉婚櫎浜嬩欢
+                HdlDeviceImageInfoLogic.Current.RemoveDeviceFirmwareVersionThread(oTADevice);
 
                 oTADevice = Common.LocalDevice.Current.GetOTADevice(listNewDevice[0].DeviceAddr);
                 //娣诲姞鍗囩骇鍥轰欢淇℃伅(鎴愪笉鎴愬姛閮芥棤鎵�璋�)
-                var result = await FirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, oTADevice.HwVersion.ToString(), oTADevice.ImgTypeId.ToString());
+                var result = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, oTADevice.HwVersion.ToString(), oTADevice.ImgTypeId.ToString());
 
                 //鑾峰彇璁惧鏈�鏂扮増鏈�
-                var deviceFirmware = FirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice,
+                var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice,
                     oTADevice.HwVersion.ToString(),
                     oTADevice.ImgTypeId.ToString(),
                     oTADevice.ImgVersion);
 
-                if (deviceFirmware != null)
+                if (deviceFirmware != null && deviceFirmware.FirmwareVersion > oTADevice.ImgVersion)
                 {
-                    if (deviceFirmware.FirmwareVersion > oTADevice.ImgVersion)
+                    Application.RunOnMainThread(() =>
                     {
-                        Application.RunOnMainThread(() =>
+                        if (btnNewVersion != null)
                         {
                             btnNewVersion.Visible = true;
-                        });
-                    }
+                        }
+                    });
                 }
-            })
-            { IsBackground = true }.Start();
-        }
-
-        /// <summary>
-        /// 鑾峰彇鍒颁簡OTA闀滃儚淇℃伅鍥炶皟(100%鐗瑰畾鍥炶皟)
-        /// </summary>
-        /// <param name="device"></param>
-        /// <param name="reportData"></param>
-        private void OtaImageInfoActionBack(CommonDevice device, CommonDevice.DeviceStatusReportData reportData)
-        {
-            this.receiveImageInfo = true;
+            });
         }
 
         #endregion
 
-        #region 鈻� 鏂瑰悜闄愪綅___________________________
-
-        /// <summary>
-        ///娣诲姞  銆愭柟鍚戦檺浣嶃�戣
-        /// </summary>
-        /// <param name="listview">Listview.</param>
-        private void AddDirectionLimitRow(VerticalScrolViewLayout listview)
-        {
-            bool canAddRow = false;
-            foreach (var device in listNewDevice)
-            {
-                if (device.Type == DeviceType.WindowCoveringDevice)
-                {
-                    canAddRow = true;
-                    break;
-                }
-            }
-            if (canAddRow == false)
-            {
-                //蹇呴』鏈変竴璺洖璺槸WindowCoveringDevice鎵嶈
-                return;
-            }
-
-            //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑
-            var myDeviceType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listNewDevice);
-            //濡傛灉鏄獥甯�
-            if (myDeviceType.BeloneType == DeviceBeloneType.A绐楀笜)
-            {
-                //鏂瑰悜涓庨檺浣嶈缃�
-                var directionLimitRow = new StatuRowLayout(listview);
-
-                var directionLimitBtn = new RowCenterView(false);
-                directionLimitBtn.TextID = R.MyInternationalizationString.DirectionLimit;
-                directionLimitRow.AddChidren(directionLimitBtn);
-                //鏂瑰悜涓庨檺浣嶈缃悜鍙崇殑鍥炬爣
-                var btnLightRight = new RowRightIconView();
-                directionLimitRow.AddChidren(btnLightRight);
-                directionLimitRow.MouseUpEvent += (sender, e) =>
-                {
-                    var form = new RollerShadeDirectionLimitSettingForm();
-                    this.AddForm(form, listNewDevice);
-                };
-            }
-        }
-
-        #endregion
-
-        #region 鈻� 缁存姢妯″紡___________________________
-
-        /// <summary>
-        /// 娣诲姞 銆愮淮鎶ゆā寮忋�戣
-        /// </summary>
-        /// <param name="listview">Listview.</param>
-        /// <param name="statu">If set to <c>true</c> statu.</param>
-        private void AddMaintenanceModeRow(VerticalScrolViewLayout listview, bool statu = false)
-        {
-            bool canAddRow = false;
-            foreach (var device in listNewDevice)
-            {
-                if (device.Type == DeviceType.WindowCoveringDevice)
-                {
-                    var rollershade = device as Rollershade;
-                    canAddRow = true;
-                    break;
-                }
-            }
-            if (canAddRow == false)
-            {
-                //蹇呴』鏈変竴璺洖璺槸WindowCoveringDevice鎵嶈
-                return;
-            }
-            //鑾峰彇杩欎竴鍫嗚澶囨椂灞炰簬浠�涔堢被鍨嬬殑
-            var myDeviceType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listNewDevice);
-            //濡傛灉鏄獥甯�
-            if (myDeviceType.BeloneType == DeviceBeloneType.A绐楀笜)
-            {
-                //绐楀笜鍙栫涓�鍥炶矾
-                var rollerShade = listNewDevice[0] as Rollershade;
-                //缁存姢妯″紡 璁剧疆
-                var maintenanceModeRow = new RowLayout
-                {
-                    Height = ControlCommonResourse.ListViewRowHeight
-                };
-                listview.AddChidren(maintenanceModeRow);
-
-                //涓嶄笂闈炶繙绋�
-                if (rollerShade.Gateway == null)
-                {
-                    return;
-                }
-                //if (rollerShade.Gateway.IsVirtual)
-                //{
-                    UserHomeView.ReadStatus(rollerShade, () =>
-                    {
-                        rollerShade.ReadCurtainDirectionAndMode();
-                    },3);
-                //}
-                //else
-                //{
-                //    //闃叉鐭椂闂村唴澶氭璇诲彇
-                //    if ((DateTime.Now - rollerShade.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
-                //    {
-                //        rollerShade.ReadCurtainDirectionAndMode();
-                //    }
-                //}
-
-                var maintenanceModeBtn = new RowTopGrayView(false);
-                maintenanceModeBtn.TextID = R.MyInternationalizationString.MaintenanceMode;
-                maintenanceModeRow.AddChidren(maintenanceModeBtn);
-
-                var Start_ban_switchBtn = new RowBottomBlackView(false);
-                Start_ban_switchBtn.TextID = R.MyInternationalizationString.Start_Forbid_Hand_Pull_Switch;
-                maintenanceModeRow.AddChidren(Start_ban_switchBtn);
-
-                switchBtn = new SwichControl();
-                switchBtn.Tag = rollerShade;
-                maintenanceModeRow.AddChidren(switchBtn);
-                switchBtn.IsSelected = rollerShade.WcdCurrentMaintenance;
-                switchBtn.MouseUpEventHandler += async (sender, e) =>
-                {
-                    try
-                    {
-                        CommonPage.Loading.Start();
-                        switchBtn.IsSelected = !switchBtn.IsSelected;
-                        var setWritableValueResponAllData = await rollerShade.SetCurtianMaintenanceAsync(switchBtn.IsSelected);
-
-                        await System.Threading.Tasks.Task.Delay(5000);
-
-                        if (setWritableValueResponAllData == null || setWritableValueResponAllData.setWritableValueResponData == null)
-                        {
-                            Shared.Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ConnectGWFail);
-                            switchBtn.IsSelected = false;
-                            return;
-                        }
-                        var status = setWritableValueResponAllData.setWritableValueResponData.Status;
-                        //浠ュ悗琛ュ厖鎻愮ず
-                        //0锛氶厤缃垚鍔燂紙鑻ラ厤缃垚鍔燂紝涓嬮潰鐨凙ttributeId瀛楁涓嶅瓨鍦級
-                        //34锛氫笉鏀寔璇ュ睘鎬�
-                        //135锛氭棤鏁堢殑灞炴�у��
-                        //141锛氭棤鏁堢殑鏁版嵁绫诲瀷
-                        if (status == 0)
-                        {
-                            System.Console.WriteLine("鍒囨崲缁存姢妯″紡鎴愬姛");
-                            //DeviceUI.ShowStatuTip(R.MyInternationalizationString.Success);
-                        }
-                        else
-                        {
-                            Shared.Common.CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ChangeMaintenanceMode_Fail);
-                            switchBtn.IsSelected = false;
-                        }
-                    }
-                    catch(Exception ex)
-                    {
-                        System.Console.WriteLine("璁剧疆缁存姢妯″紡澶辫触"+ex);
-                    }
-                    finally
-                    {
-                        CommonPage.Loading.Hide();
-                    }
-
-                };
-            }
-        }
-
-        #endregion
-
         #region 鈻� 淇敼鍚嶅瓧___________________________
 
-        /// <summary>
-        /// 璁惧閲嶅懡鍚�
-        /// </summary>
-        /// <param name="i_deviceName">deviceName.</param>
-        private async void DeviceReName(string i_deviceName)
-        {
-            //淇敼MAC鍚�
-            string deviceName = i_deviceName.Trim();
-            var result = await Common.LocalDevice.Current.ReMacName(this.listNewDevice, deviceName);
-            if (result == false)
-            {
-                return;
-            }
-
-            Application.RunOnMainThread(() =>
-            {
-                if (ActionFormClose != null)
-                {
-                    this.ActionFormClose(deviceName);
-                }
-            });
-        }
-
-        #endregion
-
-        #region 鈻� 鍒犻櫎鐣岄潰___________________________
-
         /// <summary>
-        /// 鍒濆鍖栧垹闄よ澶囩殑鐣岄潰
-        /// </summary>
-        private void InitDeleteDeviceForm()
+        /// 璁惧閲嶅懡鍚�
+        /// </summary>
+        /// <param name="i_deviceName">deviceName.</param>
+        private void DeviceReName(string i_deviceName, bool closeForm)
         {
-            var btnIcon = new TopLayoutMostRightView();
-            btnIcon.UnSelectedImagePath = "Item/More.png";
-            btnIcon.SelectedImagePath = "Item/MoreSelected.png";
-            topFrameLayout.AddChidren(btnIcon);
-            btnIcon.MouseUpEventHandler += ((sender, e) =>
-            {
-                //鏄剧ず鍒犻櫎璁惧鐨勫脊绐楃晫闈�
-                this.ShowDeleteDeviceDialogForm();
-            });
-        }
-
-        /// <summary>
-        /// 鏄剧ず鍒犻櫎璁惧鐨勫脊绐楃晫闈�
-        /// </summary>
-        private void ShowDeleteDeviceDialogForm()
-        {
-            var frame = new TopRightMenuControl(this, 1);
-            //鍒犻櫎璁惧
-            string deviceMenu = Language.StringByID(R.MyInternationalizationString.uDeleteDevice);
-            frame.AddRowMenu(deviceMenu, (obj) =>
-             {
-                 //纭瑕佸垹闄よ璁惧锛焮0}(鍒犻櫎璁惧鍚�,缁戝畾鐩爣灏嗘秷澶�)
-                 string msg = Language.StringByID(R.MyInternationalizationString.uDeleteDeviceMsg);
-                 if (msg.Contains("{0}") == true)
-                 {
-                     msg = string.Format(msg, "\r\n");
-                 }
-                 this.ShowConfirmMsg(msg, "DoDeleteDevice");
-             });
-        }
-
-        /// <summary>
-        /// 鍒犻櫎鎸囧畾璁惧
-        /// </summary>
-        public async void DoDeleteDevice()
-        {
-            //寮�鍚繘搴︽潯
-            this.ShowProgressBar();
-            //鍒犻櫎璁惧
-            bool result = await Common.LocalDevice.Current.DeleteDevice(listNewDevice);
-
-            this.CloseProgressBar();
-
+            //淇敼MAC鍚�
+            string deviceName = i_deviceName.Trim();
+            var result = Common.LocalDevice.Current.ReMacName(this.listNewDevice, deviceName);
             if (result == false)
             {
                 return;
-            }
-
-            Application.RunOnMainThread(() =>
+            }
+            if (closeForm == true)
             {
                 //鍏抽棴鐣岄潰
                 this.CloseForm();
-                //绉婚櫎璁惧鍒楄〃鐣岄潰鎸囧畾鐨勮澶�
-                this.LoadFormMethodByName("DeviceManagementMainForm", "RemoveDeviceFromMemory", listNewDevice);
-            });
+            }
+            else
+            {
+                //璁惧澶囨敞淇敼鎴愬姛!
+                string msg = Language.StringByID(R.MyInternationalizationString.uDeviceReNoteSuccess);
+                this.ShowMassage(ShowMsgType.Tip, msg);
+            }
         }
-        #endregion
 
-        #region 鈻� 鍏抽棴鐣岄潰___________________________
+        #endregion
+
+        #region 鈻� 鍙充笂瑙掕彍鍗昣________________________
+
+        /// <summary>
+        /// 鍒濆鍖栧彸涓婅鑿滃崟
+        /// </summary>
+        private void InitTopRightMenu()
+        {
+            var btnIcon = new MostRightIconControl(69, 69);
+            btnIcon.UnSelectedImagePath = "Item/More.png";
+            topFrameLayout.AddChidren(btnIcon);
+            btnIcon.InitControl();
+            btnIcon.ButtonClickEvent += ((sender, e) =>
+            {
+                //鏄剧ず鍙充笂瑙掕彍鍗曠晫闈�
+                this.ShowTopRightMenu();
+            });
+        }
+
+        /// <summary>
+        /// 鏄剧ず鍙充笂瑙掕彍鍗曠晫闈�
+        /// </summary>
+        private void ShowTopRightMenu()
+        {
+            //妫�娴嬫鍥炶矾鏄惁鎷ユ湁瀹氫綅鍔熻兘(鎷跨鐐规渶灏忕殑閭d釜鍥炶矾鍘诲畾浣�)
+            bool canTest = Common.LocalDevice.Current.DeviceIsCanFixedPosition(listNewDevice[0]);
+
+            var frame = new TopRightMenuControl(canTest == true ? 2 : 1, 1);
+            string deviceMenu = string.Empty;
+            if (canTest == true)
+            {
+                //瀹氫綅
+                deviceMenu = Language.StringByID(R.MyInternationalizationString.uFixedPosition);
+                frame.AddRowMenu(deviceMenu, "Item/FixedPosition.png", "Item/FixedPositionSelected.png", () =>
+                {
+                    //鍙戦�佸畾浣嶅姛鑳�
+                    Common.LocalDevice.Current.SetFixedPositionCommand(listNewDevice[0]);
+                });
+            }
+
+            //鍒犻櫎
+            deviceMenu = Language.StringByID(R.MyInternationalizationString.uDelete);
+            frame.AddRowMenu(deviceMenu, "Item/DeleteIcon2.png", "Item/DeleteIcon2Selected.png", () =>
+            {
+                //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹�,姝ゅ姛鑳芥棤鏁�
+                if (Common.Config.Instance.Home.IsVirtually == true)
+                {
+                    return;
+                }
+                //纭鍒犻櫎璇ヨ澶囧強鍔熻兘锛�
+                string msg = Language.StringByID(R.MyInternationalizationString.uDeleteDeviceMsg);
+                this.ShowMassage(ShowMsgType.Confirm, msg, () =>
+                {
+                    //鍒犻櫎鎸囧畾璁惧
+                    this.DoDeleteDevice();
+                });
+            });
+
+        }
+
+        /// <summary>
+        /// 鍒犻櫎鎸囧畾璁惧
+        /// </summary>
+        private void DoDeleteDevice()
+        {
+            HdlThreadLogic.Current.RunThread(async () =>
+            {
+                //鎵撳紑杩涘害鏉�
+                this.ShowProgressBar();
+
+                //鍒犻櫎璁惧
+                bool result = await Common.LocalDevice.Current.DeleteDevice(listNewDevice);
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar();
+                if (result == false)
+                {
+                    return;
+                }
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //鍏抽棴鐣岄潰
+                    this.CloseForm();
+                });
+            });
+        }
+        #endregion
+
+        #region 鈻� 鍏抽棴鐣岄潰___________________________
 
         /// <summary>
         /// 鐢婚潰鍏抽棴
         /// </summary>
-        /// <param name="isCloseForm">鏄惁鍏抽棴鐣岄潰,false鐨勬椂鍊�,鍙細璋冪敤鍏抽棴鍑芥暟閲岄潰鐨勯檮鍔犲姛鑳�</param>
-        public override void CloseForm(bool isCloseForm = true)
-        {
-            ZbGateway.StatusList.Remove(this);
-            base.CloseForm(isCloseForm);
-        }
-
-        #endregion
+        public override void CloseFormBefore()
+        {
+            HdlGatewayReceiveLogic.Current.RemoveEvent("HandPullControl");
+            //绉婚櫎鑾峰彇璁惧纭欢淇℃伅鐨勭洃鍚嚎绋�
+            HdlDeviceHardInfoLogic.Current.RemoveDeviceHardInfoThread(listNewDevice[0]);
 
-        #region 鈻� 璁惧鎺ュ彛___________________________
-        /// <summary>
-        /// Changed the specified common.
-        /// </summary>
-        /// <param name="common">Common.</param>
-        public void Changed(CommonDevice common)
-        {
-        }
-        /// <summary>
-        /// 璁惧鐘舵�佹洿鏂版帴鍙�
-        /// <para>type锛氬鏋滀负 DeviceInComingRespon:璁惧鏂颁笂鎶�</para>
-        /// <para>type锛氬鏋滀负 IASInfoReport:RemoveDeviceRespon</para>
-        /// <para>type锛氬鏋滀负 DeviceStatusReport:璁惧涓婃姤</para>
-        /// <para>type锛氬鏋滀负 IASInfoReport:IAS瀹夐槻淇℃伅涓婃姤</para>
-        /// <para>type锛氬鏋滀负 OnlineStatusChange: 璁惧鍦ㄧ嚎鐘舵�佹洿鏂�</para>
-        /// </summary>
-        /// <param name="common">Common.</param>
-        /// <param name="typeTag">Type tag.</param>
-        public void DeviceInfoChange(CommonDevice common, string typeTag)
-        {
-            if (typeTag == "DeviceStatusReport")
-            {
-                Application.RunOnMainThread(() =>
-                {
-                    try
-                    {
-                        if (switchBtn == null)
-                        {
-                            return;
-                        }
-                        var device = switchBtn.Tag as CommonDevice;
-
-                        //鏄惁涓哄綋鍓嶈澶�
-                        if (device.DeviceEpoint != common.DeviceEpoint || device.DeviceAddr != common.DeviceAddr)
-                        {
-                            return;
-                        }
-                        if ((common as Rollershade).DeviceStatusReport.CluterID != 258)
-                        {
-                            return;
-                        }
-                        var rollerShade = device as Rollershade;
-                        rollerShade.DeviceStatusReport = (common as Rollershade).DeviceStatusReport;
-
-                        var attriButeList = rollerShade.DeviceStatusReport.AttriBute;
-                        if(attriButeList==null)
-                        {
-                            return;
-                        }
-                        foreach (var attriBute in attriButeList)
-                        {
-                            //缁存姢妯″紡
-                            if (attriBute.AttributeId == 23)
-                            {
-                                if (0 < (attriBute.AttriButeData & 0x04))
-                                {
-                                    switchBtn.IsSelected = rollerShade.WcdCurrentMaintenance = true;
-                                }
-                                else
-                                {
-                                    switchBtn.IsSelected = rollerShade.WcdCurrentMaintenance = false;
-                                }
-                                rollerShade.LastDateTime = DateTime.Now;
-                            }
-                        }
-
-                    }
-                    catch (Exception ex)
-                    {
-                        System.Console.WriteLine($"Error:{ex.Message}");
-                    }
-                });
-            }
-        }
-        /// <summary>
-        /// Changeds the IL ogic status.
-        /// </summary>
-        /// <param name="logic">Logic.</param>
-        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
-        {
-        }
-        /// <summary>
-        /// Changeds the IS cene status.
-        /// </summary>
-        /// <param name="scene">Scene.</param>
-        public void ChangedISceneStatus(Scene scene)
-        {
-        }
-        #endregion
-    }
-}
+            //璁惧鏂板叆缃�
+            if (UserCenterResourse.DicActionForm.ContainsKey("AddDeviceTypeListForm") == true)
+            {
+                this.LoadFormMethodByName("DeviceListMainForm", "RefreshDeviceRow", new object[] { listNewDevice[0].DeviceAddr });
+            }
+
+            base.CloseFormBefore();
+        }
+
+        #endregion
+
+        #region 鈻� 纭欢淇℃伅___________________________
+
+        /// <summary>
+        /// 閲嶆柊鑾峰彇纭欢淇℃伅
+        /// </summary>
+        private void RefreshHardFirmwareInfo()
+        {
+            if (listNewDevice[0].DriveCode > 0)
+            {
+                //铏氭嫙璁惧娌℃湁杩欑鎿嶄綔
+                return;
+            }
+            //閲嶆柊鑾峰彇纭欢淇℃伅
+            HdlDeviceHardInfoLogic.Current.SetAllHardFirmwareInfoToDevice(listNewDevice[0], (device, reportData) =>
+            {
+                for (int i = 1; i < listNewDevice.Count; i++)
+                {
+                    //鍏ㄩ儴鍥炶矾鐨勪俊鎭兘鏄竴鑷寸殑
+                    HdlDeviceHardInfoLogic.Current.SetHardFirmwareInfo(device.DeviceStatusReport, listNewDevice[i]);
+                    listNewDevice[i].ReSave();
+                }
+            });
+        }
+
+        #endregion
+
+        #region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________
+
+        /// <summary>
+        /// 鑷韩鐨勪笂灞傜晫闈㈠叧闂悗,瀹冭嚜韬浜庢渶涓婂眰鏃�,瑙﹀彂鐨勪簨浠�
+        /// </summary>
+        public override int FormActionAgainEvent()
+        {
+            //閲嶆柊鑾峰彇涓ぎ绌鸿皟妯″潡鐨勭増鏈�
+            this.ReadAirConditionerVersion();
+
+            return 0;
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 鑾峰彇涓ぎ绌鸿皟妯″潡鐨勭増鏈�
+        /// </summary>
+        private void ReadAirConditionerVersion()
+        {
+            if (this.btnAirConditionerVersion == null)
+            {
+                return;
+            }
+            //鑾峰彇涓�....
+            this.btnAirConditionerVersion.TextID = R.MyInternationalizationString.uGetting;
+            HdlThreadLogic.Current.RunThread(async () =>
+            {
+                //璇诲彇绌鸿皟妯″潡鐗堟湰
+                var result = await HdlDeviceAirConditionerLogic.Current.ReadACFirewareVersionAsync(listNewDevice[0]);
+                if (result == null || result.readACFirewareVersionResponData == null || result.readACFirewareVersionResponData.Status != 0)
+                {
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        //鑾峰彇澶辫触
+                        btnAirConditionerVersion.TextID = R.MyInternationalizationString.uGettingFail;
+                    });
+                }
+                else
+                {
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        btnAirConditionerVersion.Text = result.readACFirewareVersionResponData.FirewareVersion.Replace("-", string.Empty);
+                    });
+                }
+            });
+        }
+
+        /// <summary>
+        /// 妫�娴嬭兘鍚︽樉绀哄姛鑳借缃殑鑿滃崟
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckCanShowFunctionSettionRow()
+        {
+            //鏂规偊鏂伴闈㈡澘娌℃湁鍔熻兘璁剧疆
+            if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FourButtonScene
+                || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_TwoButtonCurtain)
+            {
+                return false;
+            }
+            return true;
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0