From 3aa397ab145382935492b11c1f18c9634e69910b Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 10 十二月 2020 16:45:00 +0800
Subject: [PATCH] 请合并,门锁和晾衣架第一版代码

---
 ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs |  828 ++++++++++++++++++++++++++++++----------------------------
 1 files changed, 427 insertions(+), 401 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs
old mode 100755
new mode 100644
index 4d17c9a..35d0cbd
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs
@@ -5,407 +5,433 @@
 using ZigBee.Device;
 
 namespace Shared.Phone.MainPage.ControlForm
-{
+{
+  /// <summary>
+  /// 涓婚〉娣卞害鍗$墖鐨勫簳灞傚叡閫�
+  /// </summary>
+  public class DeviceDetailCardCommonForm : EditorCommonForm
+  {
+    #region 鈻� 鍙橀噺澹版槑___________________________
+
     /// <summary>
-    /// 涓婚〉娣卞害鍗$墖鐨勫簳灞傚叡閫�
+    /// 鐣岄潰鍏抽棴浜嬩欢
     /// </summary>
-    public class DeviceDetailCardCommonForm : EditorCommonForm
-    {
-        #region 鈻� 鍙橀噺澹版槑___________________________
-
-        /// <summary>
-        /// 鐣岄潰鍏抽棴浜嬩欢
-        /// </summary>
-        public Action<CommonDevice> FormCloseEvent = null;
-        /// <summary>
-        /// 璁惧瀵硅薄
-        /// </summary>
-        public CommonDevice device = null;
-        /// <summary>
-        /// 褰撳墠閫夋嫨鐨勬埧闂村璞�(鍐嶆鍒锋柊鐣岄潰鏃�,杩欎釜涓滆タ鏈夊彲鑳芥槸null)
-        /// </summary>
-        public Common.Room nowSelectRoom = null;
-        /// <summary>
-        /// 鏍囪瀹冩槸鐢卞摢涓帶浠惰皟璧风殑
-        /// </summary>
-        public ViewGroup RowOrCardControl = null;
-        /// <summary>
-        /// 鐘舵�佹帶浠�
-        /// </summary>
-        private NormalViewControl btnStatu = null;
-        /// <summary>
-        /// 璁惧鍚嶇О鎺т欢
-        /// </summary>
-        private NormalViewControl btnDeviceName = null;
-        /// <summary>
-        /// 鎴块棿鍚嶇О
-        /// </summary>
-        private NormalViewControl btnRoomName = null;
-        /// <summary>
-        /// 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋�  0:娌℃湁鑾峰彇寰楀埌  1:宸茬粡鑾峰彇寰楀埌
-        /// </summary>
-        public int ResponeResult = 0;
-        /// <summary>
-        /// 褰撳墠绔偣鐨勫姛鑳界被鍨�
-        /// </summary>
-        private DeviceFunctionType nowDeviceFuncType = DeviceFunctionType.A鏈畾涔�;
-        /// <summary>
-        /// 鐧借壊鑳屾櫙鐨勫搴�
-        /// </summary>
-        private int backFrameWidth = 0;
-        /// <summary>
-        /// 鐧借壊鑳屾櫙鐨勯珮搴�
-        /// </summary>
-        private int backFrameHeight = 0;
-        /// <summary>
-        /// 褰撳墠鐨勬枃鏈�
-        /// </summary>
-        private string CurrentText = string.Empty;
-
-        #endregion
-
-        #region 鈻� 鍒濆鍖朹____________________________
-
-        /// <summary>
-        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
-        /// </summary>
-        /// <param name="i_device">璁惧瀵硅薄</param>
-        /// <param name="i_nowSelectRoom">鎴块棿</param>
-        /// <param name="i_backWidth">鐧借壊鑳屾櫙鐨勫搴�(闈炵湡瀹炲��)</param>
-        /// <param name="i_backHeight">鐧借壊鑳屾櫙鐨勯珮搴�(闈炵湡瀹炲��)</param>
-        public void ShowForm(CommonDevice i_device, Common.Room i_nowSelectRoom, int i_backWidth, int i_backHeight)
-        {
-            this.CurrentText = Language.StringByID(R.MyInternationalizationString.Current) + "  ";
-            this.nowSelectRoom = i_nowSelectRoom;
-            this.backFrameWidth = i_backWidth;
-            this.backFrameHeight = i_backHeight;
-
-            //鏇村
-            var btnMore = new MostRightIconControl(69, 69);
-            btnMore.UnSelectedImagePath = "Item/More.png";
-            topFrameLayout.AddChidren(btnMore);
-            btnMore.InitControl();
-            btnMore.ButtonClickEvent += (sender, e) =>
-            {
-                var detailInfo = new DeviceDetailInfoForm();
-                detailInfo.AddForm(device, nowSelectRoom);
-            };
-
-            //鍒濆鍖栦腑閮ㄤ俊鎭�
-            this.InitMiddleFrame(i_device);
-            //娣诲姞璁惧涓婃姤浜嬩欢
-            this.AddDeviceReportEvent();
-        }
-
-        /// <summary>
-        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
-        /// </summary>
-        /// <param name="i_device">璁惧瀵硅薄</param>
-        /// <param name="backWidth">鐧借壊鑳屾櫙鐨勫搴�(闈炵湡瀹炲��)</param>
-        /// <param name="backHeight">鐧借壊鑳屾櫙鐨勯珮搴�(闈炵湡瀹炲��)</param>
-        private void InitMiddleFrame(CommonDevice i_device)
-        {
-            this.device = i_device;
-            this.nowDeviceFuncType = device.DfunctionType;
-
-            //娓呯┖bodyFrame
-            this.ClearBodyFrame();
-
-            //鐧借壊鑳屾櫙鎺т欢
-            var frameWhiteBack = new FrameLayout();
-            frameWhiteBack.Y = Application.GetRealHeight(115);
-            frameWhiteBack.Width = Application.GetRealWidth(this.backFrameWidth);
-            frameWhiteBack.Height = Application.GetRealHeight(this.backFrameHeight);
-            frameWhiteBack.BackgroundColor = UserCenterColor.Current.White;
-            frameWhiteBack.Radius = (uint)Application.GetRealHeight(17);
-            frameWhiteBack.Gravity = Gravity.CenterHorizontal;
-            bodyFrameLayout.AddChidren(frameWhiteBack);
-
-            //璁惧鍚嶇О
-            this.btnDeviceName = new NormalViewControl(100, 60, true);
-            btnDeviceName.Y = Application.GetRealHeight(46);
-            btnDeviceName.TextSize = 15;
-            btnDeviceName.IsBold = true;
-            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
-            btnDeviceName.Width = btnDeviceName.GetRealWidthByText();
-            btnDeviceName.TextAlignment = TextAlignment.Center;
-            btnDeviceName.Gravity = Gravity.CenterHorizontal;
-            frameWhiteBack.AddChidren(btnDeviceName);
-
-            //鐘舵��
-            this.btnStatu = new NormalViewControl(700, 42, true);
-            btnStatu.Y = btnDeviceName.Bottom + Application.GetRealHeight(12);
-            btnStatu.TextSize = 10;
-            btnStatu.TextColor = UserCenterColor.Current.TextGrayColor1;
-            btnStatu.TextAlignment = TextAlignment.Center;
-            btnStatu.Gravity = Gravity.CenterHorizontal;
-            frameWhiteBack.AddChidren(btnStatu);
-
-            //鎴块棿鐨勯粦鑹茶儗鏅�
-            var frameRoomBlack = new FrameLayout();
-            frameRoomBlack.Height = Application.GetRealHeight(138);
-            frameRoomBlack.Width = frameWhiteBack.Width;
-            frameRoomBlack.BackgroundColor = 0xff232323;
-            frameRoomBlack.Radius= (uint)Application.GetRealHeight(17);
-            frameRoomBlack.Gravity = Gravity.BottomCenter;
-            frameWhiteBack.AddChidren(frameRoomBlack);
-
-            //璁╀笂閮ㄥ彉鐩磋(鍥犱负瀹夊崜杩欓噷,鍗曠嫭鎸囧畾宸︿笅鍜屽彸涓嬭鍦嗚鐨勮瘽,鍦嗕笉浜�)
-            var frameTemp = new FrameLayout();
-            frameTemp.Height = Application.GetRealHeight(30);
-            frameTemp.Width = frameWhiteBack.Width;
-            frameTemp.BackgroundColor = frameRoomBlack.BackgroundColor;
-            frameRoomBlack.AddChidren(frameTemp);
-
-            //鎴块棿鍥炬爣
-            var btnRoomIcon = new IconViewControl(81);
-            btnRoomIcon.X = ControlCommonResourse.XXLeft;
-            btnRoomIcon.UnSelectedImagePath = "Item/Room.png";
-            btnRoomIcon.Gravity = Gravity.CenterVertical;
-            frameRoomBlack.AddChidren(btnRoomIcon);
-
-            //鎴块棿鍚嶇О
-            this.btnRoomName = new NormalViewControl(600, 52, true);
-            btnRoomName.X = btnRoomIcon.Right + Application.GetRealWidth(12);
-            btnRoomName.TextSize = 12;
-            btnRoomName.TextColor = UserCenterColor.Current.White;
-            btnRoomName.Gravity = Gravity.CenterVertical;
-            if (this.nowSelectRoom != null)
-            {
-                btnRoomName.Text = this.nowSelectRoom.Name;
-            }
-            else
-            {
-                //鏈垎閰�
-                btnRoomName.TextID = R.MyInternationalizationString.uDeviceNotAssignedRoom;
-            }
-            frameRoomBlack.AddChidren(btnRoomName);
-
-            //鏀惰棌
-            var btnCollect = new IconBigViewControl(69, 69);
-            btnCollect.UnSelectedImagePath = "Item/Collection.png";
-            btnCollect.SelectedImagePath = "Item/CollectionSelected.png";
-            btnCollect.IsSelected = HdlRoomLogic.Current.IsCollectInRoom(i_device);
-            frameWhiteBack.AddChidren(btnCollect);
-            btnCollect.InitControl();
-            btnCollect.X = Application.GetRealWidth(850) - btnCollect.XOffset;
-            btnCollect.Y = Application.GetRealHeight(35) - btnCollect.YOffset;
-            btnCollect.ButtonClickEvent += (sender, e) =>
-            {
-                //鐘舵�佸彇鍙�
-                btnCollect.IsSelected = !btnCollect.IsSelected;
-                if (btnCollect.IsSelected == false)
-                {
-                    //鍙栨秷鏀惰棌
-                    HdlRoomLogic.Current.DeleteLoveDevice(i_device);
-                }
-                else
-                {
-                    //娣诲姞鏀惰棌
-                    HdlRoomLogic.Current.AddLoveDevice(i_device);
-                }
-            };
-
-            //搴曞眰鍒濆鍖栦腑閮ㄦ帶浠跺畬鎴愪箣鍚�,璋冪敤鍚勮嚜鐣岄潰鐨勫垵濮嬪寲鍑芥暟
-            this.InitMiddleFrameAfter(frameWhiteBack);
-        }
-
-        /// <summary>
-        /// 搴曞眰鍒濆鍖栦腑閮ㄦ帶浠跺畬鎴愪箣鍚�
-        /// </summary>
-        /// <param name="frameWhiteBack">鐧借壊鑳屾櫙鎺т欢</param>
-        public virtual void InitMiddleFrameAfter(FrameLayout frameWhiteBack)
-        {
-        }
-
-        #endregion
-
-        #region 鈻� 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋淿____________
-
-        /// <summary>
-        /// 妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
-        /// </summary>
-        /// <param name="listControl">闇�瑕侀檺鍒朵笉鑳界偣鍑荤殑鎺т欢(瓒呮椂鏃�,瀹冧細杩樺師Select鐘舵��)</param>
-        /// <param name="lastAction">鍑芥暟杩愯瀹屾垚鍚庣殑鍥炶皟鍑芥暟銆傚弬鏁癴alse:娌℃湁绛夊埌缃戝叧鍥炲 true:鎺ユ敹鍒颁簡缃戝叧鍥炲</param>
-        public void StartCheckResponeResult(List<ButtonBase> listControl, Action<bool> lastAction = null)
-        {
-            this.ResponeResult = 0;
-
-            //鍏堣鎸囧畾鎺т欢涓嶈兘鐐瑰嚮
-            foreach (var myContr in listControl)
-            {
-                myContr.CanClick = false;
-            }
-
-            HdlThreadLogic.Current.RunThread(() =>
-            {
-                int waitime = 40;
-                while (waitime > 0)
-                {
-                    System.Threading.Thread.Sleep(100);
-                    if (this.ResponeResult == 1)
-                    {
-                        //宸茬粡鑾峰彇寰楀埌鏁版嵁
-                        break;
-                    }
-                    waitime--;
-                    //2绉掔殑鏃跺��,杩樻槸鎺ュ彈涓嶅埌鐨勮瘽,寮哄埗鍐嶆鍒锋柊璁惧鐘舵��
-                    if (waitime == 20)
-                    {
-                        //浠庢柊鍙戦�佽幏鍙栬澶囩殑鐘舵��(寮哄埗)
-                        this.device.HadReadDeviceStatu = false;
-                        if (this.RowOrCardControl != null)
-                        {
-                            this.RowOrCardControl.GetType().InvokeMember("SendStatuComand", System.Reflection.BindingFlags.InvokeMethod, null, this.RowOrCardControl, null);
-                        }
-                    }
-                }
-                if (waitime <= 0 && this.Parent != null)
-                {
-                    //娌℃湁鑾峰彇寰楀埌缁撴灉
-                    HdlThreadLogic.Current.RunMain(() =>
-                    {
-                        var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.FAIL));
-                        msgContr.Show();
-                    });
-                }
-                //寮�鍏虫寜閽彲浠ュ啀鐐瑰嚮
-                foreach (var myContr in listControl)
-                {
-                    myContr.CanClick = true;
-                }
-                //鍑芥暟杩愯瀹屾垚鐨勫洖璋冨嚱鏁�
-                lastAction?.Invoke(this.ResponeResult == 1);
-                lastAction = null;
-            });
-        }
-
-        /// <summary>
-        /// 妫�娴嬬綉鍏崇殑鍙嶉缁撴灉(灞炴�т笂鎶ョ殑瀵硅薄锛歞evice.DeviceStatusReport)
-        /// </summary>
-        /// <param name="comandDiv">鍛戒护鍖哄垎</param>
-        /// <param name="report">涓婃姤鏁版嵁</param>
-        public virtual bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report)
-        {
-            return false;
-        }
-
-        /// <summary>
-        /// 娣诲姞璁惧涓婃姤浜嬩欢
-        /// </summary>
-        private void AddDeviceReportEvent()
-        {
-            string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device);
-            //灞炴�т笂鎶�
-            HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceDetailCardAttribute" + mainKeys, ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
-            {
-                string mainKey2 = Common.LocalDevice.Current.GetDeviceMainKeys(report);
-                if (mainKeys != mainKey2)
-                {
-                    //涓嶆槸鍚屼竴涓笢瑗�
-                    return;
-                }
-                //妫�娴嬬粨鏋�
-                if (this.CheckResponeResultStatu(ReceiveComandDiv.A璁惧灞炴�т笂鎶�, report) == true)
-                {
-                    //缁撴灉宸茬粡鎺ユ敹鍒�
-                    this.ResponeResult = 1;
-                }
-            });
-        }
-
-        #endregion
-
-        #region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________
-
-        /// <summary>
-        /// 鑷韩鐨勪笂灞傜晫闈㈠叧闂悗,瀹冭嚜韬浜庢渶涓婂眰鏃�,瑙﹀彂鐨勪簨浠�
-        /// </summary>
-        public override int FormActionAgainEvent()
-        {
-            //濡傛灉涓嶆槸鍠滅埍鎴块棿鐨勮瘽,瀹冪殑鎴块棿鏈夊彲鑳借鍒囨崲浜�
-            if (this.nowSelectRoom == null || this.nowSelectRoom.IsLove == false)
-            {
-                this.nowSelectRoom = HdlRoomLogic.Current.GetRoomByDevice(this.device);
-            }
-            //濡傛灉鍔熻兘绫诲瀷鍙樻洿浜�
-            if (this.nowDeviceFuncType != this.device.DfunctionType)
-            {
-                //閲嶆柊鍒锋柊鐣岄潰,鍒濆鍖栦腑閮ㄤ俊鎭�
-                this.InitMiddleFrame(this.device);
-            }
-            else
-            {
-                //鍒锋柊鍚嶅瓧
-                this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(this.device);
-                btnDeviceName.Width = btnDeviceName.GetRealWidthByText();
-                btnDeviceName.Gravity = Gravity.CenterHorizontal;
-                if (this.nowSelectRoom == null)
-                {
-                    //鏈垎閰�
-                    this.btnRoomName.TextID = R.MyInternationalizationString.uDeviceNotAssignedRoom;
-                }
-                else
-                {
-                    this.btnRoomName.Text = this.nowSelectRoom.Name;
-                }
-            }
-
-            return 1;
-        }
-
-        #endregion
-
-        #region 鈻� 鐣岄潰鍏抽棴___________________________
-
-        /// <summary>
-        /// 鐣岄潰鍏抽棴
-        /// </summary>
-        public override void CloseFormBefore()
-        {
-            string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device);
-            HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardAttribute" + mainKeys);
-
-            //鍥炶皟鍑芥暟
-            this.FormCloseEvent?.Invoke(this.device);
-            this.FormCloseEvent = null;
-
-            base.CloseFormBefore();
-        }
-
-        #endregion
-
-        #region 鈻� 涓�鑸柟娉昣__________________________
-
-        /// <summary>
-        /// 璁剧疆鐘舵�佹枃鏈�(涓嶉渶瑕佹寚瀹氥�愬綋鍓嶄袱涓瓧銆�)
-        /// </summary>
-        /// <param name="text"></param>
-        public void SetStatuText(string text)
-        {
-            this.btnStatu.Text = this.CurrentText + text;
-        }
-
-        /// <summary>
-        /// 璁剧疆PM2.5浼犳劅鍣ㄧ姸鎬佹枃鏈�(涓嶉渶瑕佹寚瀹氥�愬綋鍓嶄袱涓瓧銆�)
-        /// </summary>
-        /// <param name="text"></param>
-        public void SetPmTwoPointFiveStatuText(string text)
-        {
-            this.btnStatu.Text = text;
-        }
-
-        /// <summary>
-        /// 閲嶆柊璁剧疆璁惧鍚嶅瓧鎺т欢鍜岀姸鎬佹帶浠剁殑Y杞�
-        /// </summary>
-        /// <param name="i_NameY">璁惧鍚嶅瓧鎺т欢鐨刌杞�(鐪熷疄鍊�)</param>
-        /// <param name="i_StatuY">鐘舵�佹帶浠剁殑Y杞�(鐪熷疄鍊�)</param>
-        public void ResetDeviceNameAndStatuPoint(int i_NameY, int i_StatuY)
-        {
-            btnDeviceName.Y = i_NameY;
-            btnStatu.Y = i_StatuY;
-        }
-
-        #endregion
-    }
+    public Action<CommonDevice> FormCloseEvent = null;
+    /// <summary>
+    /// 璁惧瀵硅薄
+    /// </summary>
+    public CommonDevice device = null;
+    /// <summary>
+    /// 褰撳墠閫夋嫨鐨勬埧闂村璞�(鍐嶆鍒锋柊鐣岄潰鏃�,杩欎釜涓滆タ鏈夊彲鑳芥槸null)
+    /// </summary>
+    public Common.Room nowSelectRoom = null;
+    /// <summary>
+    /// 鏍囪瀹冩槸鐢卞摢涓帶浠惰皟璧风殑
+    /// </summary>
+    public ViewGroup RowOrCardControl = null;
+    /// <summary>
+    /// 鐘舵�佹帶浠�
+    /// </summary>
+    private NormalViewControl btnStatu = null;
+    /// <summary>
+    /// 璁惧鍚嶇О鎺т欢
+    /// </summary>
+    private NormalViewControl btnDeviceName = null;
+    /// <summary>
+    /// 鎴块棿鍚嶇О
+    /// </summary>
+    private NormalViewControl btnRoomName = null;
+    /// <summary>
+    /// 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋�  0:娌℃湁鑾峰彇寰楀埌  1:宸茬粡鑾峰彇寰楀埌
+    /// </summary>
+    public int ResponeResult = 0;
+    /// <summary>
+    /// 褰撳墠绔偣鐨勫姛鑳界被鍨�
+    /// </summary>
+    private DeviceFunctionType nowDeviceFuncType = DeviceFunctionType.A鏈畾涔�;
+    /// <summary>
+    /// 鐧借壊鑳屾櫙鐨勫搴�
+    /// </summary>
+    private int backFrameWidth = 0;
+    /// <summary>
+    /// 鐧借壊鑳屾櫙鐨勯珮搴�
+    /// </summary>
+    private int backFrameHeight = 0;
+    /// <summary>
+    /// 褰撳墠鐨勬枃鏈�
+    /// </summary>
+    private string CurrentText = string.Empty;
+
+    #endregion
+
+    #region 鈻� 鍒濆鍖朹____________________________
+
+    /// <summary>
+    /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+    /// </summary>
+    /// <param name="i_device">璁惧瀵硅薄</param>
+    /// <param name="i_nowSelectRoom">鎴块棿</param>
+    /// <param name="i_backWidth">鐧借壊鑳屾櫙鐨勫搴�(闈炵湡瀹炲��)</param>
+    /// <param name="i_backHeight">鐧借壊鑳屾櫙鐨勯珮搴�(闈炵湡瀹炲��)</param>
+    public void ShowForm(CommonDevice i_device, Common.Room i_nowSelectRoom, int i_backWidth, int i_backHeight)
+    {
+      this.CurrentText = Language.StringByID(R.MyInternationalizationString.Current) + "  ";
+      this.nowSelectRoom = i_nowSelectRoom;
+      this.backFrameWidth = i_backWidth;
+      this.backFrameHeight = i_backHeight;
+
+      //鏇村
+      var btnMore = new MostRightIconControl(69, 69);
+      btnMore.UnSelectedImagePath = "Item/More.png";
+      topFrameLayout.AddChidren(btnMore);
+      btnMore.InitControl();
+      btnMore.ButtonClickEvent += (sender, e) =>
+      {
+        //鑾峰彇璁惧灞炰簬銆愭櫨琛f灦銆�
+        var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice> { device });
+        if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.Airer)
+        {
+          var form = new Shared.Phone.UserCenter.Device.DeviceFunctionSettionForm();
+          form.AddForm(device, true);
+        }
+        else
+        {
+          var detailInfo = new DeviceDetailInfoForm();
+          detailInfo.AddForm(device, nowSelectRoom);
+        }
+
+      };
+
+      //鍒濆鍖栦腑閮ㄤ俊鎭�
+      this.InitMiddleFrame(i_device);
+      //娣诲姞璁惧涓婃姤浜嬩欢
+      this.AddDeviceReportEvent();
+    }
+
+    /// <summary>
+    /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+    /// </summary>
+    /// <param name="i_device">璁惧瀵硅薄</param>
+    /// <param name="backWidth">鐧借壊鑳屾櫙鐨勫搴�(闈炵湡瀹炲��)</param>
+    /// <param name="backHeight">鐧借壊鑳屾櫙鐨勯珮搴�(闈炵湡瀹炲��)</param>
+    private void InitMiddleFrame(CommonDevice i_device)
+    {
+      this.device = i_device;
+      this.nowDeviceFuncType = device.DfunctionType;
+
+      //娓呯┖bodyFrame
+      this.ClearBodyFrame();
+
+      //鐧借壊鑳屾櫙鎺т欢
+      var frameWhiteBack = new FrameLayout();
+      frameWhiteBack.Y = Application.GetRealHeight(115);
+      frameWhiteBack.Width = Application.GetRealWidth(this.backFrameWidth);
+      frameWhiteBack.Height = Application.GetRealHeight(this.backFrameHeight);
+      frameWhiteBack.BackgroundColor = UserCenterColor.Current.White;
+      frameWhiteBack.Radius = (uint)Application.GetRealHeight(17);
+      frameWhiteBack.Gravity = Gravity.CenterHorizontal;
+      bodyFrameLayout.AddChidren(frameWhiteBack);
+
+      //璁惧鍚嶇О
+      this.btnDeviceName = new NormalViewControl(100, 60, true);
+      btnDeviceName.Y = Application.GetRealHeight(46);
+      btnDeviceName.TextSize = 15;
+      btnDeviceName.IsBold = true;
+      btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
+      btnDeviceName.Width = btnDeviceName.GetRealWidthByText();
+      btnDeviceName.TextAlignment = TextAlignment.Center;
+      btnDeviceName.Gravity = Gravity.CenterHorizontal;
+      frameWhiteBack.AddChidren(btnDeviceName);
+
+      //鐘舵��
+      this.btnStatu = new NormalViewControl(700, 42, true);
+      btnStatu.Y = btnDeviceName.Bottom + Application.GetRealHeight(12);
+      btnStatu.TextSize = 10;
+      btnStatu.TextColor = UserCenterColor.Current.TextGrayColor1;
+      btnStatu.TextAlignment = TextAlignment.Center;
+      btnStatu.Gravity = Gravity.CenterHorizontal;
+      frameWhiteBack.AddChidren(btnStatu);
+
+      //鎴块棿鐨勯粦鑹茶儗鏅�
+      var frameRoomBlack = new FrameLayout();
+      frameRoomBlack.Height = Application.GetRealHeight(138);
+      frameRoomBlack.Width = frameWhiteBack.Width;
+      frameRoomBlack.BackgroundColor = 0xff232323;
+      frameRoomBlack.Radius = (uint)Application.GetRealHeight(17);
+      frameRoomBlack.Gravity = Gravity.BottomCenter;
+      frameWhiteBack.AddChidren(frameRoomBlack);
+
+      //璁╀笂閮ㄥ彉鐩磋(鍥犱负瀹夊崜杩欓噷,鍗曠嫭鎸囧畾宸︿笅鍜屽彸涓嬭鍦嗚鐨勮瘽,鍦嗕笉浜�)
+      var frameTemp = new FrameLayout();
+      frameTemp.Height = Application.GetRealHeight(30);
+      frameTemp.Width = frameWhiteBack.Width;
+      frameTemp.BackgroundColor = frameRoomBlack.BackgroundColor;
+      frameRoomBlack.AddChidren(frameTemp);
+
+      //鎴块棿鍥炬爣
+      var btnRoomIcon = new IconViewControl(81);
+      btnRoomIcon.X = ControlCommonResourse.XXLeft;
+      btnRoomIcon.UnSelectedImagePath = "Item/Room.png";
+      btnRoomIcon.Gravity = Gravity.CenterVertical;
+      frameRoomBlack.AddChidren(btnRoomIcon);
+
+      //鎴块棿鍚嶇О
+      this.btnRoomName = new NormalViewControl(600, 52, true);
+      btnRoomName.X = btnRoomIcon.Right + Application.GetRealWidth(12);
+      btnRoomName.TextSize = 12;
+      btnRoomName.TextColor = UserCenterColor.Current.White;
+      btnRoomName.Gravity = Gravity.CenterVertical;
+      if (this.nowSelectRoom != null)
+      {
+        btnRoomName.Text = this.nowSelectRoom.Name;
+      }
+      else
+      {
+        //鏈垎閰�
+        btnRoomName.TextID = R.MyInternationalizationString.uDeviceNotAssignedRoom;
+      }
+      frameRoomBlack.AddChidren(btnRoomName);
+
+      //鏀惰棌
+      var btnCollect = new IconBigViewControl(69, 69);
+      btnCollect.UnSelectedImagePath = "Item/Collection.png";
+      btnCollect.SelectedImagePath = "Item/CollectionSelected.png";
+      btnCollect.IsSelected = HdlRoomLogic.Current.IsCollectInRoom(i_device);
+      frameWhiteBack.AddChidren(btnCollect);
+      btnCollect.InitControl();
+      btnCollect.X = Application.GetRealWidth(850) - btnCollect.XOffset;
+      btnCollect.Y = Application.GetRealHeight(35) - btnCollect.YOffset;
+      btnCollect.ButtonClickEvent += (sender, e) =>
+      {
+        //鐘舵�佸彇鍙�
+        btnCollect.IsSelected = !btnCollect.IsSelected;
+        if (btnCollect.IsSelected == false)
+        {
+          //鍙栨秷鏀惰棌
+          HdlRoomLogic.Current.DeleteLoveDevice(i_device);
+        }
+        else
+        {
+          //娣诲姞鏀惰棌
+          HdlRoomLogic.Current.AddLoveDevice(i_device);
+        }
+      };
+
+      //搴曞眰鍒濆鍖栦腑閮ㄦ帶浠跺畬鎴愪箣鍚�,璋冪敤鍚勮嚜鐣岄潰鐨勫垵濮嬪寲鍑芥暟
+      this.InitMiddleFrameAfter(frameWhiteBack);
+    }
+
+    /// <summary>
+    /// 搴曞眰鍒濆鍖栦腑閮ㄦ帶浠跺畬鎴愪箣鍚�
+    /// </summary>
+    /// <param name="frameWhiteBack">鐧借壊鑳屾櫙鎺т欢</param>
+    public virtual void InitMiddleFrameAfter(FrameLayout frameWhiteBack)
+    {
+    }
+
+    #endregion
+
+    #region 鈻� 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋淿____________
+
+    /// <summary>
+    /// 妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
+    /// </summary>
+    /// <param name="listControl">闇�瑕侀檺鍒朵笉鑳界偣鍑荤殑鎺т欢(瓒呮椂鏃�,瀹冧細杩樺師Select鐘舵��)</param>
+    /// <param name="lastAction">鍑芥暟杩愯瀹屾垚鍚庣殑鍥炶皟鍑芥暟銆傚弬鏁癴alse:娌℃湁绛夊埌缃戝叧鍥炲 true:鎺ユ敹鍒颁簡缃戝叧鍥炲</param>
+    public void StartCheckResponeResult(List<ButtonBase> listControl, Action<bool> lastAction = null)
+    {
+      this.ResponeResult = 0;
+
+      //鍏堣鎸囧畾鎺т欢涓嶈兘鐐瑰嚮
+      foreach (var myContr in listControl)
+      {
+        myContr.CanClick = false;
+      }
+
+      HdlThreadLogic.Current.RunThread(() =>
+      {
+        int waitime = 40;
+        while (waitime > 0)
+        {
+          System.Threading.Thread.Sleep(100);
+          if (this.ResponeResult == 1)
+          {
+            //宸茬粡鑾峰彇寰楀埌鏁版嵁
+            break;
+          }
+          waitime--;
+          //2绉掔殑鏃跺��,杩樻槸鎺ュ彈涓嶅埌鐨勮瘽,寮哄埗鍐嶆鍒锋柊璁惧鐘舵��
+          if (waitime == 20)
+          {
+            //浠庢柊鍙戦�佽幏鍙栬澶囩殑鐘舵��(寮哄埗)
+            this.device.HadReadDeviceStatu = false;
+            if (this.RowOrCardControl != null)
+            {
+              this.RowOrCardControl.GetType().InvokeMember("SendStatuComand", System.Reflection.BindingFlags.InvokeMethod, null, this.RowOrCardControl, null);
+            }
+          }
+        }
+        if (waitime <= 0 && this.Parent != null)
+        {
+          //娌℃湁鑾峰彇寰楀埌缁撴灉
+          HdlThreadLogic.Current.RunMain(() =>
+          {
+            var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.FAIL));
+            msgContr.Show();
+          });
+        }
+        //寮�鍏虫寜閽彲浠ュ啀鐐瑰嚮
+        foreach (var myContr in listControl)
+        {
+          myContr.CanClick = true;
+        }
+        //鍑芥暟杩愯瀹屾垚鐨勫洖璋冨嚱鏁�
+        lastAction?.Invoke(this.ResponeResult == 1);
+        lastAction = null;
+      });
+    }
+
+    /// <summary>
+    /// 妫�娴嬬綉鍏崇殑鍙嶉缁撴灉(灞炴�т笂鎶ョ殑瀵硅薄锛歞evice.DeviceStatusReport)
+    /// </summary>
+    /// <param name="comandDiv">鍛戒护鍖哄垎</param>
+    /// <param name="report">涓婃姤鏁版嵁</param>
+    public virtual bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report)
+    {
+      return false;
+    }
+
+    /// <summary>
+    /// 娣诲姞璁惧涓婃姤浜嬩欢
+    /// </summary>
+    private void AddDeviceReportEvent()
+    {
+      string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device);
+      //灞炴�т笂鎶�
+      HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceDetailCardAttribute" + mainKeys, ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
+      {
+        string mainKey2 = Common.LocalDevice.Current.GetDeviceMainKeys(report);
+
+        if (this.device.Type == DeviceType.Airer && this.device.DeviceAddr == report.DeviceAddr)
+        {
+          //鏅捐。鏋剁壒娈婏細5涓洖璺唬琛ㄤ笉鍚岀殑鍔熻兘锛屼絾鏄粯璁ゆ湰鍦板彧鏄剧ず浜嗙涓�涓洖璺�
+          //鎵�浠ユ潯浠剁壒娈婂垽鏂�
+          //妫�娴嬬粨鏋�
+          if (this.CheckResponeResultStatu(ReceiveComandDiv.A璁惧灞炴�т笂鎶�, report) == true)
+          {
+            //缁撴灉宸茬粡鎺ユ敹鍒�
+            this.ResponeResult = 1;
+          }
+        }
+        else
+        {
+          if (mainKeys != mainKey2)
+          {
+            //涓嶆槸鍚屼竴涓笢瑗�
+            return;
+          }
+          //妫�娴嬬粨鏋�
+          if (this.CheckResponeResultStatu(ReceiveComandDiv.A璁惧灞炴�т笂鎶�, report) == true)
+          {
+            //缁撴灉宸茬粡鎺ユ敹鍒�
+            this.ResponeResult = 1;
+          }
+        }
+      });
+    }
+
+    #endregion
+
+    #region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________
+
+    /// <summary>
+    /// 鑷韩鐨勪笂灞傜晫闈㈠叧闂悗,瀹冭嚜韬浜庢渶涓婂眰鏃�,瑙﹀彂鐨勪簨浠�
+    /// </summary>
+    public override int FormActionAgainEvent()
+    {
+      //濡傛灉涓嶆槸鍠滅埍鎴块棿鐨勮瘽,瀹冪殑鎴块棿鏈夊彲鑳借鍒囨崲浜�
+      if (this.nowSelectRoom == null || this.nowSelectRoom.IsLove == false)
+      {
+        this.nowSelectRoom = HdlRoomLogic.Current.GetRoomByDevice(this.device);
+      }
+      //濡傛灉鍔熻兘绫诲瀷鍙樻洿浜�
+      if (this.nowDeviceFuncType != this.device.DfunctionType)
+      {
+        //閲嶆柊鍒锋柊鐣岄潰,鍒濆鍖栦腑閮ㄤ俊鎭�
+        this.InitMiddleFrame(this.device);
+      }
+      else
+      {
+        //鍒锋柊鍚嶅瓧
+        this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(this.device);
+        btnDeviceName.Width = btnDeviceName.GetRealWidthByText();
+        btnDeviceName.Gravity = Gravity.CenterHorizontal;
+        if (this.nowSelectRoom == null)
+        {
+          //鏈垎閰�
+          this.btnRoomName.TextID = R.MyInternationalizationString.uDeviceNotAssignedRoom;
+        }
+        else
+        {
+          this.btnRoomName.Text = this.nowSelectRoom.Name;
+        }
+      }
+
+      return 1;
+    }
+
+    #endregion
+
+    #region 鈻� 鐣岄潰鍏抽棴___________________________
+
+    /// <summary>
+    /// 鐣岄潰鍏抽棴
+    /// </summary>
+    public override void CloseFormBefore()
+    {
+      string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device);
+      HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardAttribute" + mainKeys);
+
+      //鍥炶皟鍑芥暟
+      this.FormCloseEvent?.Invoke(this.device);
+      this.FormCloseEvent = null;
+
+      base.CloseFormBefore();
+    }
+
+    #endregion
+
+    #region 鈻� 涓�鑸柟娉昣__________________________
+
+    /// <summary>
+    /// 璁剧疆鐘舵�佹枃鏈�(涓嶉渶瑕佹寚瀹氥�愬綋鍓嶄袱涓瓧銆�)
+    /// </summary>
+    /// <param name="text"></param>
+    public void SetStatuText(string text)
+    {
+      this.btnStatu.Text = this.CurrentText + text;
+    }
+
+    /// <summary>
+    /// 璁剧疆PM2.5浼犳劅鍣ㄧ姸鎬佹枃鏈�(涓嶉渶瑕佹寚瀹氥�愬綋鍓嶄袱涓瓧銆�)
+    /// </summary>
+    /// <param name="text"></param>
+    public void SetPmTwoPointFiveStatuText(string text)
+    {
+      this.btnStatu.Text = text;
+    }
+
+    /// <summary>
+    /// 閲嶆柊璁剧疆璁惧鍚嶅瓧鎺т欢鍜岀姸鎬佹帶浠剁殑Y杞�
+    /// </summary>
+    /// <param name="i_NameY">璁惧鍚嶅瓧鎺т欢鐨刌杞�(鐪熷疄鍊�)</param>
+    /// <param name="i_StatuY">鐘舵�佹帶浠剁殑Y杞�(鐪熷疄鍊�)</param>
+    public void ResetDeviceNameAndStatuPoint(int i_NameY, int i_StatuY)
+    {
+      btnDeviceName.Y = i_NameY;
+      btnStatu.Y = i_StatuY;
+    }
+
+    #endregion
+  }
 }

--
Gitblit v1.8.0