From f14dcfd967404e197e7ec995ca8d6f2b090d3b7d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 11 九月 2020 09:16:59 +0800
Subject: [PATCH] 优化多功能面板:绑定温湿度传感器目标,和设备列表回路显示。优化数据矫正功能温湿度度不设置的情况。优化门锁时间设置最后一天和最后最后一个月的时间显示等 细节

---
 ZigbeeApp/Shared/Phone/Category/AdjustTargetAddDeviceForm.cs |  664 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 664 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Category/AdjustTargetAddDeviceForm.cs b/ZigbeeApp/Shared/Phone/Category/AdjustTargetAddDeviceForm.cs
new file mode 100755
index 0000000..37e40de
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/Category/AdjustTargetAddDeviceForm.cs
@@ -0,0 +1,664 @@
+锘縰sing Shared.Common;
+using Shared.Phone.UserCenter;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.Category
+{
+    /// <summary>
+    /// 鍦烘櫙鎵ц鐩爣娣诲姞璁惧鐨勭晫闈�
+    /// </summary>
+    public class AdjustTargetAddDeviceForm : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 瀹屾垚閫夋嫨鐨勪簨浠�(Key:璁惧涓婚敭)
+        /// </summary>
+        public Action<Dictionary<string, List<Safeguard.TaskListInfo>>> FinishSelectEvent = null;
+        /// <summary>
+        /// 褰撳墠宸茬粡娣诲姞鐨勬墽琛岀洰鏍�
+        /// </summary>
+        private List<Scene.DeviceListData> listAdjustTarget = null;
+        /// <summary>
+        /// 褰撳墠宸茬粡娣诲姞鐨勬墽琛岀洰鏍囷紙瀛樺湪妫�娴嬬敤锛�
+        /// </summary>
+        private Dictionary<string, List<Safeguard.TaskListInfo>> dicOldListTask = null;
+        /// <summary>
+        /// 褰撳墠鐣岄潰涓婃樉绀虹殑鎵ц鐩爣锛堝瓨鍦ㄦ娴嬬敤锛�
+        /// </summary>
+        private Dictionary<string, List<Safeguard.TaskListInfo>> dicNewListTask = null;
+        /// <summary>
+        /// 瀹屾垚鎸夐挳
+        /// </summary>
+        private BottomClickButton btnFinishControl = null;
+        /// <summary>
+        /// 璁惧鍔熻兘鐨勮彍鍗曟帶浠�
+        /// </summary>
+        private HorizontalScrolViewLayout deviceFunctionMenuContr = null;
+        /// <summary>
+        /// 璁惧鍒楄〃鎺т欢
+        /// </summary>
+        private VerticalListControl listDeviceView = null;
+        /// <summary>
+        /// 褰撳墠閫夋嫨鐨勬ゼ灞�
+        /// </summary>
+        private string nowSelectFloorId = string.Empty;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        /// <param name="i_listAdjustTarget">褰撳墠鎵ц鐩爣鍒楄〃</param>
+        public void ShowForm(List<Scene.DeviceListData> i_listAdjustTarget)
+        {
+            this.listAdjustTarget = i_listAdjustTarget;
+
+            //璁剧疆澶撮儴淇℃伅
+            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.AddFunction));
+            //鍒濆鍖栧彸涓婅鐨勬帶浠�
+            this.InitTopRightMenuControl();
+            //鍒濆鍖栦腑閮ㄤ俊鎭�
+            this.InitMiddleFrame();
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        /// </summary>
+        private void InitMiddleFrame()
+        {
+            //娓呯┖body
+            this.ClearBodyFrame();
+            //鍒濆鍖栨埧闂磋彍鍗曟帶浠�
+            this.InitRoomMenuControl();
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栧彸涓婅鐨勬帶浠�
+        /// </summary>
+        private void InitTopRightMenuControl()
+        {
+            //鑾峰彇妤煎眰
+            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
+            if (dicFloor.Count == 0)
+            {
+                return;
+            }
+            var btnIconContr = new MostRightIconControl(69, 69);
+            btnIconContr.UnSelectedImagePath = "Item/Drop_Down.png";
+            topFrameLayout.AddChidren(btnIconContr);
+            btnIconContr.InitControl();
+
+            var btnFloor = new NormalViewControl(300, 69, true);
+            btnFloor.Gravity = Gravity.CenterVertical;
+            btnFloor.X = btnIconContr.X + btnIconContr.btnIcon.X - Application.GetRealWidth(300);
+            btnFloor.TextAlignment = TextAlignment.CenterRight;
+            topFrameLayout.AddChidren(btnFloor);
+
+            foreach (var floorId in dicFloor.Keys)
+            {
+                //绗竴涓ゼ灞�
+                this.nowSelectFloorId = floorId;
+                btnFloor.Text = dicFloor[floorId];
+                break;
+            }
+
+            btnIconContr.ButtonClickEvent += (sender, e) =>
+            {
+                //妤煎眰鑿滃崟
+                var contr = new TopRightFloorMenuControl(dicFloor.Count, 2, this.nowSelectFloorId, Language.StringByID(R.MyInternationalizationString.SelectFloor));
+                foreach (var floorId in dicFloor.Keys)
+                {
+                    contr.AddRowMenu(floorId, () =>
+                    {
+                        //璁板綍璧烽�夋嫨鐨処D
+                        this.nowSelectFloorId = floorId;
+                        btnFloor.Text = dicFloor[this.nowSelectFloorId];
+                        //鍒濆鍖栦腑閮ㄤ俊鎭�
+                        this.InitMiddleFrame();
+                    });
+                }
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 鎴块棿鑿滃崟鎺т欢_______________________
+
+        /// <summary>
+        /// 鍒濆鍖栨埧闂磋彍鍗曟帶浠�
+        /// </summary>
+        private void InitRoomMenuControl()
+        {
+            //鑾峰彇鑳藉鏄剧ず鐨勬埧闂村垪琛�
+            var listRoom = this.GetCanShowRoomList();
+            if (listRoom.Count == 0)
+            {
+                //娌℃湁鍙互娣诲姞鐨勭洰鏍�
+                this.ShowNotDataImage(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uNotHadAddTarget));
+                return;
+            }
+
+            //杩欎釜鎺т欢鐨勯珮搴︿负:鎴块棿鑿滃崟鐨勫簳閮ㄥ埌灞忓箷搴曢儴
+            var functionBodyView = new FrameLayout();
+
+            //鎴块棿鑿滃崟鎺т欢
+            var roomSwitchContr = new RoomDeviceGroupMenuControl(listRoom);
+            this.bodyFrameLayout.AddChidren(roomSwitchContr);
+            //閫夋嫨浜嬩欢
+            roomSwitchContr.SelectRoomEvent += (selectRoom) =>
+            {
+                //鍦ㄥ闈㈡竻绌�(鐗规晥鐨勯棶棰�)
+                if (this.deviceFunctionMenuContr != null && this.deviceFunctionMenuContr.Parent != null)
+                {
+                    this.deviceFunctionMenuContr.RemoveAll();
+                }
+                this.listDeviceView?.RemoveAll();
+
+                HdlThreadLogic.Current.RunMainInThread(() =>
+                {
+                    //鍒锋柊璁惧鍒嗘敮鎺т欢
+                    this.RefreshFunctionView(selectRoom, functionBodyView);
+                });
+            };
+
+            functionBodyView.Y = roomSwitchContr.Bottom;
+            functionBodyView.Height = bodyFrameLayout.Height - roomSwitchContr.Bottom;
+            bodyFrameLayout.AddChidren(functionBodyView);
+
+            //瀹屾垚鎸夐挳
+            this.btnFinishControl = new BottomClickButton();
+            btnFinishControl.TextID = R.MyInternationalizationString.uFinish;
+            bodyFrameLayout.AddChidren(btnFinishControl);
+            if (this.dicNewListTask == null || this.dicNewListTask.Count == 0)
+            {
+                btnFinishControl.Visible = false;
+            }
+            btnFinishControl.ButtonClickEvent += (sender, e) =>
+            {
+                //鍥炶皟鍑芥暟
+                this.FinishSelectEvent?.Invoke(this.dicNewListTask);
+
+                this.CloseForm();
+            };
+
+            //鎵ц鍒濆鍖�(浼氳嚜鍔ㄨЕ鍙慡electRoomEvent浜嬩欢)
+            roomSwitchContr.InitControl();
+        }
+
+        /// <summary>
+        /// 鑾峰彇鑳藉鏄剧ず鐨勬埧闂村垪琛�
+        /// </summary>
+        /// <param name="listRomm"></param>
+        /// <returns></returns>
+        private List<Room> GetCanShowRoomList()
+        {
+            if (this.dicNewListTask == null)
+            {
+                //鍏堝皢鍒楄〃Dictionary鍖�
+                this.dicNewListTask = new Dictionary<string, List<Safeguard.TaskListInfo>>();
+                this.dicOldListTask = new Dictionary<string, List<Safeguard.TaskListInfo>>();
+                foreach (var data in this.listAdjustTarget)
+                {
+                    if (data.Type == 0)
+                    {
+                        //鍙璁惧
+                        string mainkey = LocalDevice.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint);
+                        dicOldListTask[mainkey] = data.TaskList;
+                    }
+                }
+            }
+          
+            //褰撳墠妤煎眰鐨勫叏閮ㄦ埧闂�
+            var lisrRoom = HdlRoomLogic.Current.GetRoomsByFloorIdAppendLoveRoom(this.nowSelectFloorId);
+            var listShowRoom = new List<Room>();
+            foreach (var room in lisrRoom)
+            {
+                foreach (var mainkey in room.ListDevice)
+                {
+                    var device = LocalDevice.Current.GetDevice(mainkey);
+                    if (this.CheckDeviceCanShow(device) == true)
+                    {
+                        //杩欎釜璁惧鏈湴瀛樺湪,骞朵笖瀹冭繕娌℃湁鍔犲叆鍒版墽琛岀洰鏍囧垪琛�,鍒欒繖涓埧闂村彲浠ユ樉绀�
+                        listShowRoom.Add(room);
+                        break;
+                    }
+                }
+            }
+            return listShowRoom;
+        }
+
+        #endregion
+
+        #region 鈻� 鍔熻兘鍒嗘敮___________________________
+
+        /// <summary>
+        /// 鍒锋柊鍔熻兘鍒嗘敮鎺т欢
+        /// </summary>
+        /// <param name="room"></param>
+        private void RefreshFunctionView(Common.Room room, FrameLayout functionBodyView)
+        {
+            //鑾峰彇鍒嗙粍鍚庣殑璁惧
+            var dicGroupDevice = this.GetAllGroupDevice(room);
+
+            //鍙垵濮嬪寲涓�娆�
+            if (this.deviceFunctionMenuContr == null || this.deviceFunctionMenuContr.Parent == null)
+            {
+                //璁惧鑿滃崟鐨勭櫧鑹茶儗鏅�
+                var functionBack1 = new FrameLayout();
+                functionBack1.X = ControlCommonResourse.XXLeft;
+                functionBack1.Height = Application.GetRealHeight(160);
+                functionBack1.Width = Application.GetRealWidth(1028);
+                functionBack1.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
+                functionBodyView.AddChidren(functionBack1);
+                functionBack1.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft);
+                var functionBack2 = new FrameLayout();
+                functionBack2.X = ControlCommonResourse.XXLeft;
+                functionBack2.Y = functionBack1.Bottom - Application.GetRealHeight(50);
+                functionBack2.Height = Application.GetRealHeight(279 - 160 + 50);
+                functionBack2.Width = Application.GetRealWidth(1028);
+                functionBack2.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
+                functionBodyView.AddChidren(functionBack2);
+                functionBack2.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft);
+
+                //璁惧鑿滃崟鐨勫乏鍙虫粦鍔ㄧ殑鎺т欢
+                this.deviceFunctionMenuContr = new HorizontalScrolViewLayout();
+                deviceFunctionMenuContr.X = ControlCommonResourse.XXLeft;
+                deviceFunctionMenuContr.Height = Application.GetRealHeight(279);
+                deviceFunctionMenuContr.Width = Application.GetRealWidth(1028);
+                functionBodyView.AddChidren(deviceFunctionMenuContr);
+
+                //璁惧鐨勮儗鏅鍣�
+                var frameDeviceBack = new FrameLayout();
+                frameDeviceBack.X = ControlCommonResourse.XXLeft;
+                frameDeviceBack.Y = deviceFunctionMenuContr.Bottom + Application.GetRealHeight(35);
+                frameDeviceBack.BackgroundColor = UserCenterColor.Current.White;
+                frameDeviceBack.Width = bodyFrameLayout.Width;
+                frameDeviceBack.Height = functionBodyView.Height - deviceFunctionMenuContr.Bottom - Application.GetRealHeight(35);
+                frameDeviceBack.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
+                functionBodyView.AddChidren(frameDeviceBack);
+
+                //璁惧鍒楄〃鎺т欢
+                this.listDeviceView = new VerticalListControl(35);
+                listDeviceView.Y = Application.GetRealHeight(11);
+                listDeviceView.Width = Application.GetRealWidth(1022);
+                listDeviceView.Height = frameDeviceBack.Height - Application.GetRealHeight(11);
+                listDeviceView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
+                frameDeviceBack.AddChidren(listDeviceView);
+            }
+
+            //涓婁竴娆¢�夋嫨鐨勮彍鍗曞拰鏁版嵁
+            DeviceRowInfo nowSelectDeviceInfo = null;
+            MainPage.Controls.DeviceFunctionUnallocatedControl oldSelectContr = null;
+            foreach (string strText in dicGroupDevice.Keys)
+            {
+                var rowInfo = dicGroupDevice[strText];
+
+                //璁惧绫诲瀷鐨勫鍣�
+                var devieFrame = new FrameLayout();
+                devieFrame.Width = Application.GetRealWidth(220);
+                deviceFunctionMenuContr.AddChidren(devieFrame);
+
+                //鑿滃崟鍥剧墖鎺т欢
+                var deviceObjContr = new MainPage.Controls.DeviceFunctionUnallocatedControl();
+                devieFrame.AddChidren(deviceObjContr);
+                deviceObjContr.InitControl(strText, rowInfo.IconPath, rowInfo.IconPathSelected, rowInfo.listDeviceKeys);
+                deviceObjContr.ButtonClickEvent += (sender, e) =>
+                {
+                    //閫夋嫨鐨勬槸鍚屼竴涓笢瑗跨殑璇�,涓嶅鐞�
+                    if (nowSelectDeviceInfo.TextId != rowInfo.TextId)
+                    {
+                        //涓婁竴娆$殑鑿滃崟鍙栨秷,鏈鑿滃崟閫夋嫨
+                        oldSelectContr.SetSelectStatu(false);
+                        deviceObjContr.SetSelectStatu(true);
+                        oldSelectContr = deviceObjContr;
+
+                        nowSelectDeviceInfo = rowInfo;
+                        HdlThreadLogic.Current.RunMainInThread(() =>
+                        {
+                            //鍒濆鍖栬澶囧垪琛ㄦ帶浠�
+                            this.InitListDeviceControls(listDeviceView, rowInfo);
+                        });
+                    }
+                };
+
+                if (nowSelectDeviceInfo == null)
+                {
+                    //璁剧疆鍒濆閫夋嫨
+                    nowSelectDeviceInfo = rowInfo;
+                    //璁板綍鍒濆閫夋嫨鐨勮彍鍗曟帶浠�
+                    oldSelectContr = deviceObjContr;
+                    deviceObjContr.SetSelectStatu(true);
+                }
+            }
+            if (nowSelectDeviceInfo != null)
+            {
+                //鍒濆鍖栭粯璁ょ殑璁惧鍒楄〃鎺т欢
+                this.InitListDeviceControls(listDeviceView, nowSelectDeviceInfo);
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖栬澶囧垪琛ㄦ帶浠禵________________
+
+        /// <summary>
+        /// 鍒濆鍖栬澶囧垪琛ㄦ帶浠�
+        /// </summary>
+        /// <param name="listView"></param>
+        /// <param name="rowInfo"></param>
+        private void InitListDeviceControls(VerticalListControl listView, DeviceRowInfo rowInfo)
+        {
+            //鍏堟竻绌�
+            listView.RemoveAll();
+
+            var listDevice = new List<CommonDevice>();
+            for (int i = 0; i < rowInfo.listDeviceKeys.Count; i++)
+            {
+                var device = LocalDevice.Current.GetDevice(rowInfo.listDeviceKeys[i]);
+                if (device != null)
+                {
+                    listDevice.Add(device);
+                }
+                else
+                {
+                    rowInfo.listDeviceKeys.RemoveAt(i);
+                    i--;
+                }
+            }
+
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                foreach (var device in listDevice)
+                {
+                    //娣诲姞璁惧琛�
+                    this.AddDeviceRow(listView, device);
+                }
+                //璋冩暣妗屽竷,淇冧娇瀹冭兘澶熸粦鍔ㄨ秴杩囧畬鎴愭寜閽�
+                listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(23), Application.GetRealHeight(529));
+            });
+        }
+
+        /// <summary>
+        /// 娣诲姞璁惧琛�
+        /// </summary>
+        /// <param name="listView"></param>
+        /// <param name="device"></param>
+        private void AddDeviceRow(VerticalListControl listView, CommonDevice device)
+        {
+            string mainkey = LocalDevice.Current.GetDeviceMainKeys(device);
+            //璁惧鎺т欢
+            var rowDevice = new FrameRowControl(listView.rowSpace / 2);
+            rowDevice.RightOffset = ControlCommonResourse.XXLeft - Application.GetRealWidth(109);
+            listView.AddChidren(rowDevice);
+
+            //璁惧鍥炬爣鑳屾櫙鎺т欢
+            var frameIconBackGroud = new FrameLayout();
+            frameIconBackGroud.Height = this.GetPictrueRealSize(112);
+            frameIconBackGroud.Width = this.GetPictrueRealSize(112);
+            frameIconBackGroud.Gravity = Gravity.CenterVertical;
+            frameIconBackGroud.X = Application.GetRealWidth(46);
+            frameIconBackGroud.Radius = (uint)this.GetPictrueRealSize(112 / 2);
+            frameIconBackGroud.BackgroundColor = Common.ZigbeeColor.Current.GXCGrayBackgroundColor;
+            rowDevice.AddChidren(frameIconBackGroud, ChidrenBindMode.NotBind);
+            frameIconBackGroud.Y += rowDevice.chidrenYaxis;
+
+            //璁惧鍥炬爣鎺т欢
+            var btnDeviceIcon = new IconViewControl(78);
+            btnDeviceIcon.Gravity = Gravity.Center;
+            Common.LocalDevice.Current.SetDeviceIconToControl(btnDeviceIcon, device);
+            frameIconBackGroud.AddChidren(btnDeviceIcon);
+            //閲嶆柊缁戝畾浜嬩欢
+            rowDevice.ChangedChidrenBindMode(frameIconBackGroud, ChidrenBindMode.BindEvent);
+
+            //璁惧鍚嶅瓧
+            var btnDeviceName = new NormalViewControl(600, 60, true);
+            btnDeviceName.X = Application.GetRealWidth(181);
+            btnDeviceName.Gravity = Gravity.CenterVertical;
+            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
+            rowDevice.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent);
+            btnDeviceName.Y += rowDevice.chidrenYaxis;
+            //搴曠嚎
+            var btnBottomLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false);
+            btnBottomLine.X = Application.GetRealWidth(181);
+            btnBottomLine.Y = rowDevice.Height - ControlCommonResourse.BottomLineHeight;
+            btnBottomLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
+            rowDevice.AddChidren(btnBottomLine, ChidrenBindMode.NotBind);
+            //鍙崇澶�
+            rowDevice.AddRightArrow();
+            //鐘舵��
+            var btnStatu = rowDevice.AddMostRightView("", 400);
+            if (this.dicNewListTask.ContainsKey(mainkey) == true)
+            {
+                //鏄剧ず閰嶇疆鐘舵��
+                btnStatu.Text = HdlSafeguardLogic.Current.GetAdjustTargetStatuText(dicNewListTask[mainkey]);
+            }
+            rowDevice.ButtonClickEvent += (sender, e) =>
+            {
+                //鍔熻兘鐨勮缁嗛厤缃�
+                this.ShowDeviceDetailSettion(device, btnStatu);
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 鍔熻兘鐨勮缁嗛厤缃甠____________________
+
+        /// <summary>
+        /// 鍔熻兘鐨勮缁嗛厤缃�
+        /// </summary>
+        /// <param name="device"></param>
+        /// <param name="btnStatu"></param>
+        private void ShowDeviceDetailSettion(CommonDevice device, NormalViewControl btnStatu)
+        {
+            string mainKeys = LocalDevice.Current.GetDeviceMainKeys(device);
+
+            List<Safeguard.TaskListInfo> listTaskinfo = null;
+            if (dicNewListTask.ContainsKey(mainKeys) == true)
+            {
+                //鍙栫紦瀛樹腑杩樻湭淇濆瓨鐨勬暟鎹�
+                listTaskinfo = dicNewListTask[mainKeys];
+            }
+
+            if (device.Type == DeviceType.DimmableLight//璋冨厜鍣�
+                || device.Type == DeviceType.ColorDimmableLight)//褰╃伅
+            {
+                var form = new UserCenter.Safety.AlarmTargetStatuSelectLightForm();
+                form.AddForm(device, listTaskinfo);
+                form.FinishSelectEvent += (statuText, listInfo) =>
+                {
+                    if (listInfo.Count == 0) { statuText = string.Empty; }
+                    btnStatu.Text = statuText;
+                    //灏嗘柊鐨勬墽琛岀洰鏍囨坊鍔犲叆缂撳瓨
+                    this.AddSettionDataToMemory(device, listInfo);
+                };
+            }
+            else if (device.Type == DeviceType.Thermostat)//绌鸿皟
+            {
+                var form = new UserCenter.Safety.AlarmTargetStatuSelectAcForm();
+                form.AddForm(device, listTaskinfo);
+                form.FinishSelectEvent += (statuText, listInfo) =>
+                {
+                    if (listInfo.Count == 0) { statuText = string.Empty; }
+                    btnStatu.Text = statuText;
+                    //灏嗘柊鐨勬墽琛岀洰鏍囨坊鍔犲叆缂撳瓨
+                    this.AddSettionDataToMemory(device, listInfo);
+                };
+            }
+            else if (device.Type == DeviceType.WindowCoveringDevice)//绐楀笜
+            {
+                var form = new UserCenter.Safety.AlarmTargetStatuSelectCurtainForm();
+                form.AddForm(device, listTaskinfo);
+                form.FinishSelectEvent += (statuText, listInfo) =>
+                {
+                    if (listInfo.Count == 0) { statuText = string.Empty; }
+                    btnStatu.Text = statuText;
+                    //灏嗘柊鐨勬墽琛岀洰鏍囨坊鍔犲叆缂撳瓨
+                    this.AddSettionDataToMemory(device, listInfo);
+                };
+            }
+            else
+            {
+                //鍏朵粬鐩存帴褰掍负寮�鍏崇被
+                var form = new UserCenter.Safety.AlarmTargetStatuSelectSwitchForm();
+                form.AddForm(device, listTaskinfo);
+                form.FinishSelectEvent += (statuText, listInfo) =>
+                {
+                    if (listInfo.Count == 0) { statuText = string.Empty; }
+                    btnStatu.Text = statuText;
+                    //灏嗘柊鐨勬墽琛岀洰鏍囨坊鍔犲叆缂撳瓨
+                    this.AddSettionDataToMemory(device, listInfo);
+                };
+            }
+        }
+
+        /// <summary>
+        /// 灏嗘柊鐨勬墽琛岀洰鏍囨坊鍔犲叆缂撳瓨
+        /// </summary>
+        /// <param name="deviceInfo"></param>
+        /// <param name="listInfo"></param>
+        private void AddSettionDataToMemory(CommonDevice device, List<Safeguard.TaskListInfo> listInfo)
+        {
+            string mainKeys = LocalDevice.Current.GetDeviceMainKeys(device);
+            if (listInfo == null || listInfo.Count == 0)
+            {
+                //鎸囧畾涓烘棤鍔ㄤ綔妯″紡
+                if (this.dicNewListTask.ContainsKey(mainKeys) == true)
+                {
+                    this.dicNewListTask.Remove(mainKeys);
+                    if (dicNewListTask.Count == 0)
+                    {
+                        this.btnFinishControl.Visible = false;
+                    }
+                }
+            }
+            else
+            {
+                //纭娣诲姞鍔ㄤ綔
+                this.dicNewListTask[mainKeys] = listInfo;
+                if (this.btnFinishControl.Visible == false)
+                {
+                    this.btnFinishControl.Visible = true;
+                }
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 鏁村悎璁惧___________________________
+
+        /// <summary>
+        /// 鑾峰彇鍒嗙粍鍚庣殑璁惧
+        /// </summary>
+        /// <returns></returns>
+        private Dictionary<string, DeviceRowInfo> GetAllGroupDevice(Common.Room room)
+        {
+            //鍏ㄩ儴鐨勮澶�
+            var listDeviceTemp = HdlRoomLogic.Current.GetRoomListDevice(room);
+            var listDevice = new List<CommonDevice>();
+            foreach (var device in listDeviceTemp)
+            {
+                //鍒ゆ柇璇ヨ澶囪兘鍚︽樉绀�
+                if (this.CheckDeviceCanShow(device) == true)
+                {
+                    listDevice.Add(device);
+                }
+            }
+
+            //鏍规嵁璁惧鎵�灞炵被鍨嬫帓搴�
+            listDevice = LocalDevice.Current.SortDeviceByBelongType(listDevice);
+            var dic = new Dictionary<string, DeviceRowInfo>();
+            foreach (var device in listDevice)
+            {
+                var typeInfo = LocalDevice.Current.GetDeviceBelongEnumInfo(device);
+                //鎸夋墍灞濱D鍒嗙粍
+                if (dic.ContainsKey(typeInfo.BeloneText) == false)
+                {
+                    dic[typeInfo.BeloneText] = new DeviceRowInfo();
+                    string path1 = string.Empty;
+                    string path2 = string.Empty;
+                    //鑾峰彇鍥剧墖
+                    LocalDevice.Current.GetDeviceFunctionTypeMenuIcon(typeInfo.ConcreteType, ref path1, ref path2);
+                    dic[typeInfo.BeloneText].IconPath = path1;
+                    dic[typeInfo.BeloneText].IconPathSelected = path2;
+                    dic[typeInfo.BeloneText].TextId = typeInfo.BeloneText;
+                }
+                dic[typeInfo.BeloneText].listDeviceKeys.Add(LocalDevice.Current.GetDeviceMainKeys(device));
+            }
+            return dic;
+        }
+
+        #endregion
+
+        #region 鈻� 鐣岄潰鍏抽棴___________________________
+
+        /// <summary>
+        /// 鐣岄潰鍏抽棴
+        /// </summary>
+        public override void CloseFormBefore()
+        {
+            this.FinishSelectEvent = null;
+
+            base.CloseFormBefore();
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 妫�娴嬭澶囪兘鍚︽樉绀�
+        /// </summary>
+        /// <param name="device"></param>
+        private bool CheckDeviceCanShow(CommonDevice device)
+        {
+            if (device == null) { return false; }
+            if (device.Type == DeviceType.AirSwitch ||//绌烘皵寮�鍏�
+                device.Type == DeviceType.ColorDimmableLight ||//璋冨厜鐏�
+                device.Type == DeviceType.DimmableLight ||//褰╃伅
+                device.Type == DeviceType.OnOffOutput ||//缁х數鍣�
+                device.Type == DeviceType.Thermostat ||//绌鸿皟
+                device.Type == DeviceType.ColorTemperatureLight ||//鑹叉俯鐏�
+                device.Type == DeviceType.WindowCoveringDevice)//绐楀笜
+            {
+                string mainkey = LocalDevice.Current.GetDeviceMainKeys(device);
+                return this.dicOldListTask.ContainsKey(mainkey) == false;
+            }
+            return false;
+        }
+
+        #endregion
+
+        #region 鈻� 缁撴瀯浣揰____________________________
+
+        /// <summary>
+        /// 璁惧琛屼俊鎭�
+        /// </summary>
+        private class DeviceRowInfo
+        {
+            /// <summary>
+            /// 鏂囨湰,鐩墠鐢ㄦ潵鍋氫富閿�
+            /// </summary>
+            public string TextId = string.Empty;
+            /// <summary>
+            /// 鍥炬爣
+            /// </summary>
+            public string IconPath = string.Empty;
+            /// <summary>
+            /// 鍥炬爣
+            /// </summary>
+            public string IconPathSelected = string.Empty;
+            /// <summary>
+            /// 璁惧鍥炶矾涓婚敭
+            /// </summary>
+            public List<string> listDeviceKeys = new List<string>();
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0