From 304dca51c28183a9dfc192c6b93ea1c00bdd5d97 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 01 七月 2020 15:00:40 +0800 Subject: [PATCH] 添加了写入功能类型 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs | 1292 ++++++++++++++++++++------------------------------------- 1 files changed, 461 insertions(+), 831 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelSimpleMutilfunctionBindSensorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs similarity index 61% rename from ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelSimpleMutilfunctionBindSensorForm.cs rename to ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs index c7c2992..d7e25e7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelSimpleMutilfunctionBindSensorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs @@ -1,36 +1,38 @@ 锘縰sing System; using System.Collections.Generic; -using System.Linq.Expressions; using Shared.Common; -using Shared.Phone.UserCenter.Safety; +using Shared.Phone.UserCenter.DeviceBind; using ZigBee.Device; using static ZigBee.Device.BindObj; using static ZigBee.Device.Panel; - -namespace Shared.Phone.UserCenter.DeviceBind +namespace Shared.Phone.UserCenter.Device.Bind { - public class PanelSimpleMutilfunctionBindSensorForm : BindCommonLayout + public class PaneTargetsBaseForm : BindCommonLayout { #region 鏋勯�犲嚱鏁� /// <summary> /// 鏋勯�犲嚱鏁� /// </summary> /// <param name="device"></param> - /// <param name="deviceBindType">1:娓╁害浼犳劅鍣�;2:婀垮害浼犳劅鍣� </param> + /// <param name="deviceBindType">1:鏂伴;2:娓╁害浼犳劅鍣�;3:婀垮害浼犳劅鍣�;4:PM2.5浼犳劅鍣�;5:绌鸿皟鐩爣</param> /// <param name="bindDev">缁戝畾鐩爣 </param> - public PanelSimpleMutilfunctionBindSensorForm(CommonDevice device, CommonDevice bindDev, int deviceBindType) + public PaneTargetsBaseForm(CommonDevice device, CommonDevice bindDev, DeviceBind.BindInfo.BindType deviceBindType) { - this.curControlDev = device as FreshAir; + curControlDev = new Panel(); + curControlDev.DeviceAddr = device.DeviceAddr; + curControlDev.DeviceEpoint = device.DeviceEpoint; + curControlDev.CurrentGateWayId = device.CurrentGateWayId; + curControlDev.Type = device.Type; this.curBindDevice = bindDev; this.curDeviceBindType = deviceBindType; } #endregion - #region 鍙橀噺鐢虫槑 + #region 鍙橀噺鐢虫槑 /// <summary> - /// 褰撳墠鏂伴闈㈡澘銆愭帶鍒惰澶囥�� + /// 鎺у埗璁惧 /// </summary> - FreshAir curControlDev; + Panel curControlDev; /// <summary> /// 褰撳墠琚粦璁惧 /// </summary> @@ -38,7 +40,7 @@ /// <summary> /// 鏄剧ず琚粦瀹氳澶囨垨鍦烘櫙鐨剉iew /// </summary> - VerticalFrameRefreshControl midVerticalScrolViewLayout; + VerticalRefreshLayout midVerticalScrolViewLayout; /// <summary> /// 鏄剧ず鎴块棿鐨剉iew /// </summary> @@ -47,6 +49,14 @@ /// 鎸夐敭閰嶇疆鐨勭洰鏍囧垪琛� /// </summary> List<CommonDevice> targetList = new List<CommonDevice>(); + /// <summary> + /// 鎸夐敭閰嶇疆鐨勭洰鏍囦复鏃跺垪琛� + /// </summary> + List<CommonDevice> targetListTemp = new List<CommonDevice>(); + /// <summary> + /// 涓存椂鎴块棿 + /// </summary> + Room tempRoom; /// <summary> /// 闈㈡澘涓凡缁忓瓨鍦ㄧ殑鐩爣鍒楄〃 /// </summary> @@ -57,8 +67,9 @@ /// 2:娓╁害浼犳劅鍣� /// 3:婀垮害浼犳劅鍣� /// 4:PM2.5浼犳劅鍣� + /// 5:绌鸿皟鐩爣 /// </summary> - int curDeviceBindType = 0; + DeviceBind.BindInfo.BindType curDeviceBindType = 0; /// <summary> /// 鏈湴鎴块棿鍒楄〃 /// </summary> @@ -72,6 +83,14 @@ /// </summary> Button btnFloorText; /// <summary> + /// 绌虹洰鏍囨寜閽� + /// </summary> + Button btnTipPic; + /// <summary> + /// 绌虹洰鏍囨枃鏈� + /// </summary> + Button btnTipText; + /// <summary> /// 妤煎眰鍒楄〃 /// </summary> Dictionary<string, string> dicFloorList; @@ -79,6 +98,10 @@ /// 鎵�鏈夋埧闂翠腑鏀寔琚粦瀹氱殑璁惧鍒楄〃 /// </summary> List<CommonDevice> currentPanelSupportBindDeviceList = new List<CommonDevice>(); + /// <summary> + /// 鏈垎閰嶇殑璁惧鍒楄〃 + /// </summary> + List<CommonDevice> undistruibuteDevList = new List<CommonDevice>(); /// <summary> /// 褰撳墠鎴块棿涓敮鎸佽缁戝畾鐨勮澶囧垪琛� /// </summary> @@ -103,30 +126,48 @@ /// PM缁戝畾鐩爣鍥炶皟 /// </summary> public Action<string> actionPMTarget = null; + /// <summary> + /// Ac缁戝畾鐩爣鍥炶皟 + /// </summary> + public Action<string> actionAcTarget = null; #endregion - #region UI璁捐 + #region UI璁捐 /// <summary> /// 鐩爣椤垫樉绀� /// </summary> public void Show() { - #region 鏍囬鏍� + TitleUI(); + //鏍囬鏍忎笅鐨刄I + MidFrameLayoutContent(); + //鍒濆鍖栬澶囨暟鎹� + InitData(); + } + + /// <summary> + /// 鏍囬鏍� + /// </summary> + void TitleUI() + { string titleText = ""; switch (curDeviceBindType) { - case 1: - titleText = Language.StringByID(R.MyInternationalizationString.BindFreshAirTarget); + case DeviceBind.BindInfo.BindType.FreshAir: + titleText = Language.StringByID(R.MyInternationalizationString.uNewWindTarget); break; - case 2: + case DeviceBind.BindInfo.BindType.Temperature: titleText = Language.StringByID(R.MyInternationalizationString.TemperatureSource); break; - case 3: + case DeviceBind.BindInfo.BindType.Humidity: titleText = Language.StringByID(R.MyInternationalizationString.HumiditySource); break; - case 4: + case DeviceBind.BindInfo.BindType.PM: titleText = Language.StringByID(R.MyInternationalizationString.PM25Source); + break; + case DeviceBind.BindInfo.BindType.AC: + titleText = Language.StringByID(R.MyInternationalizationString.AcTargets); break; } this.TopFrameLayout(this, titleText); @@ -138,68 +179,6 @@ this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; this.MidFrameLayout(this); - #endregion - - //娣诲姞妤煎眰UI - BindDownFrameLayout(); - //鏍囬鏍忎笅鐨刄I - MidFrameLayoutContent(); - //鍒濆鍖栬澶囨暟鎹� - InitData(); - } - - /// <summary> - /// 娣诲姞妤煎眰UI - /// </summary> - void BindDownFrameLayout() - { - var btnAddFrameLayout = new FrameLayout - { - X = Application.GetRealWidth(619), - }; - this.titleFrameLayout.AddChidren(btnAddFrameLayout); - - btnFloorText = new Button - { - Width = Application.GetRealWidth(300 - 69 - 58), - Text = Language.StringByID(R.MyInternationalizationString.FirstFloor), - TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, - TextSize = 14, - IsBold = true, - TextAlignment = TextAlignment.CenterRight, - }; - btnAddFrameLayout.AddChidren(btnFloorText); - - var btnBindDownFrameLayout = new FrameLayout - { - Width = Application.GetMinReal(69 + 58), - X = Application.GetRealWidth(300 - 69 - 58), - }; - btnAddFrameLayout.AddChidren(btnBindDownFrameLayout); - - var btnBindDown = new Button - { - Height = Application.GetMinReal(69), - Width = Application.GetMinReal(69), - UnSelectedImagePath = "BindPic/BindDown.png", - Gravity = Gravity.CenterVertical, - }; - btnBindDownFrameLayout.AddChidren(btnBindDown); - - EventHandler<MouseEventArgs> eHandlerBindDown = (sender, e) => - { - SideslipFramelayout(); - }; - btnBindDown.MouseDownEventHandler += eHandlerBindDown; - btnBindDownFrameLayout.MouseDownEventHandler += eHandlerBindDown; - if (Common.Config.Instance.Home.FloorDics.Count == 0) - { - btnAddFrameLayout.Width = 0; - } - else - { - btnAddFrameLayout.Width = Application.GetRealWidth(300); - } } /// <summary> @@ -221,7 +200,7 @@ btnMidTopLayout.AddChidren(btnHorizontalScrolViewLayout); //璁惧鏍� - midVerticalScrolViewLayout = new VerticalFrameRefreshControl() + midVerticalScrolViewLayout = new VerticalRefreshLayout() { Y = btnMidTopLayout.Bottom, Height = Application.GetRealHeight(1145), @@ -237,14 +216,73 @@ var bottomFrameLayout = new FrameLayout() { Width = LayoutParams.MatchParent, - Height = Application.GetRealHeight(127), - Y = Application.GetRealHeight(1472), + Height = Application.GetRealHeight(84 * 2 + 127), + Y = Application.GetRealHeight(1388), }; this.midFrameLayout.AddChidren(bottomFrameLayout); + var btnTipPicFrameLayout = new FrameLayout() + { + Width = Application.GetMinReal(40 + 23 + 37), + Height = Application.GetMinReal(40 + 44 - 10), + X = Application.GetMinReal(383 - 37), + }; + bottomFrameLayout.AddChidren(btnTipPicFrameLayout); + + btnTipPic = new Button() + { + Width = Application.GetMinReal(40), + Height = Application.GetMinReal(40), + X = Application.GetMinReal(40), + Y = Application.GetRealHeight(22), + UnSelectedImagePath = "BindPic/EmptyTargets.png", + SelectedImagePath = "BindPic/EmptyTargetsSelected.png", + }; + btnTipPicFrameLayout.AddChidren(btnTipPic); + + btnTipText = new Button() + { + Height = Application.GetRealHeight(84 - 10), + X = Application.GetMinReal(444), + Width = Application.GetMinReal(1080 - 446), + TextID = R.MyInternationalizationString.BindEmptyTargets, + TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,//XMTopTitleText + TextSize = 12, + TextAlignment = TextAlignment.CenterLeft, + }; + bottomFrameLayout.AddChidren(btnTipText); + + EventHandler<MouseEventArgs> eHandlerEmptyTargets = (sender, e) => + { + if (!btnFinifh.Enable) + { + return; + } + if (btnTipPic.IsSelected) + { + btnTipPic.IsSelected = false; + foreach (var d in targetListTemp) + { + targetList.Add(d); + } + btnTipText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; + } + else + { + btnTipPic.IsSelected = true; + targetList.Clear(); + btnTipText.TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText; + } + RefreshDeviceList(tempRoom); + }; + btnTipPicFrameLayout.MouseDownEventHandler += eHandlerEmptyTargets; + btnTipPic.MouseDownEventHandler += eHandlerEmptyTargets; + btnFinifh = new Button() { - Width = Application.GetRealWidth(907), + Width = Application.GetRealWidth(907), + Height = Application.GetRealHeight(127), + Y = Application.GetRealHeight(49 + 35), Gravity = Gravity.CenterHorizontal, Radius = (uint)Application.GetRealHeight(127) / 2, TextID = R.MyInternationalizationString.Save, @@ -254,7 +292,7 @@ TextSize = 16, }; bottomFrameLayout.AddChidren(btnFinifh); - btnFinifh.MouseUpEventHandler += async (sender, e) => + btnFinifh.MouseUpEventHandler += (sender, e) => { SaveTarget(); }; @@ -276,9 +314,16 @@ Button curentOldRoom = null; FrameLayout curentOldRoomFrameLayout = null; int index = 0; - var roomTempList = GetSupportRoomList(); + var roomTempList = BindInfo.GetSupportRoomList(curControlDev, supportRoomList, curDeviceBindType); Room slectedRoom = null; + var roomUn = new Room(); + roomUn.Name = Language.StringByID(R.MyInternationalizationString.Undistributed); + roomUn.Id = "UndistributedId"; + if (undistruibuteDevList.Count != 0) + { + roomTempList.Add(roomUn); + } for (int i = 0; i < roomTempList.Count; i++) { var room = roomTempList[i]; @@ -292,7 +337,7 @@ var btnRoomFrameLayout = new FrameLayout { Height = Application.GetMinReal(159), - Width = Application.GetMinReal(255), + Width = Application.GetMinReal(255 + 20), Y = Application.GetRealHeight(23), X = Application.GetRealWidth(5), BackgroundImagePath = "Item/RoomIconBackground.png", @@ -302,8 +347,8 @@ var btnRoom = new Button { - Height = Application.GetRealHeight(58), - Width = Application.GetRealWidth(127), + Height = Application.GetRealHeight(66), + Width = Application.GetRealWidth(187), Y = Application.GetRealHeight(58), X = Application.GetRealWidth(14), Text = room.Name, @@ -322,10 +367,10 @@ curentOldRoomFrameLayout = btnRoomFrameLayout; } - //琚粦瀹氱殑鐩爣杩樻湭鍒嗛厤鍖哄煙锛岄粯璁ゆ槸绗竴涓� + //琚粦瀹氱殑鐩爣杩樻湭鍒嗛厤鍖哄煙锛岄粯璁ゆ槸鏈�鍚庝竴涓紝鏈垎閰嶆埧闂� if (string.IsNullOrEmpty(curControlDev.currentSelectRoomId)) { - if (index == 0) + if (index == roomTempList.Count - 1) { btnRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; btnRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite; @@ -376,7 +421,7 @@ //鏂伴闈㈡澘淇濆瓨浣胯兘 btnFinifh.Enable = true; btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - + tempRoom = curRoom; RefreshDeviceList(curRoom); }; btnRoom.MouseUpEventHandler += eHandlerRoom; @@ -393,14 +438,20 @@ { if (slectedRoom == null) { - curRoom = roomTempList[0]; + //鏈�変腑榛樿鏈�鍚庝竴涓�滄湭鍒嗛厤閫変腑鈥� + curRoom = roomTempList[index - 1]; + var view = btnHorizontalScrolViewLayout.GetChildren(index - 1); + var frame = (FrameLayout)view; + var btn = (Button)frame.GetChildren(0); + frame.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; + btn.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite; } else { curRoom = slectedRoom; } } - + tempRoom = curRoom; RefreshDeviceList(curRoom); } @@ -414,7 +465,14 @@ Button oldDevice = null; int curIndex = 0; - currentRoomSupportBindDeviceList = GetCurRoomSupportDeviceList(curRoom); + if (curRoom.Id == "UndistributedId") + { + currentRoomSupportBindDeviceList = BindInfo.GetUndistributeDeviceList(undistruibuteDevList, curDeviceBindType); + } + else + { + currentRoomSupportBindDeviceList = BindInfo.GetCurRoomSupportDeviceList(currentRoomSupportBindDeviceList, curRoom, curDeviceBindType); + } if (currentRoomSupportBindDeviceList.Count == 0) { btnFinifh.Enable = false; @@ -445,7 +503,6 @@ { Width = Application.GetRealWidth(790), X = devicePic.Right + Application.GetRealWidth(20), - TextColor = Shared.Common.ZigbeeColor.Current.TextBlack, TextAlignment = TextAlignment.CenterLeft, TextSize = 15, Text = Common.LocalDevice.Current.GetDeviceEpointName(device), @@ -477,28 +534,38 @@ { line2.Visible = false; } - + if (Common.LocalDevice.Current.CheckDeviceIsOnline(device) == true) + { + btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.TextBlack; + } + else + { + btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; + } switch (curDeviceBindType) { - case 1: + case DeviceBind.BindInfo.BindType.FreshAir: devicePic.UnSelectedImagePath = "Device/FreshAirEpoint.png"; break; - case 2: + case DeviceBind.BindInfo.BindType.Temperature: devicePic.UnSelectedImagePath = "Device/SensorTemperature.png"; if (device.Type == DeviceType.PMSensor) { btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); } break; - case 3: + case DeviceBind.BindInfo.BindType.Humidity: devicePic.UnSelectedImagePath = "Device/SensorHumidity.png"; if (device.Type == DeviceType.PMSensor) { btnBindName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); } break; - case 4: + case DeviceBind.BindInfo.BindType.PM: devicePic.UnSelectedImagePath = "Device/AirQualitySensorEpoint.png"; + break; + case DeviceBind.BindInfo.BindType.AC: + devicePic.UnSelectedImagePath = "Device/AirConditionerEpoint.png"; break; } #endregion @@ -519,7 +586,21 @@ EventHandler<MouseEventArgs> hander = (sender, e) => { - btnChoose.IsSelected = !btnChoose.IsSelected; + if (btnChoose.IsSelected) + { + return; + } + if (btnTipPic.IsSelected) + { + btnTipPic.IsSelected = false; + foreach (var d in targetListTemp) + { + targetList.Add(d); + } + btnTipText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; + } + btnChoose.IsSelected = true; + if (!btnChoose.IsSelected) { if (oldDevice != null) @@ -545,8 +626,11 @@ targetList.Clear(); targetList.Add(device); } - - //鏂伴闈㈡澘锛氱敱浜庣洰鏍囨病鏈夋彁渚涘垹闄ゆ帴鍙o紝鎵�浠ュ彲浠ュ彇娑堥�変腑鑳戒繚瀛� + targetListTemp.Clear(); + foreach (var d in targetList) + { + targetListTemp.Add(d); + } btnFinifh.Enable = true; btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; }; @@ -558,148 +642,6 @@ } } - /// <summary> - /// 妤煎眰閫夋嫨鐨勪晶杈规爮 - /// </summary> - void SideslipFramelayout() - { - var dialog = new Dialog - { - }; - dialog.Show(); - - var flMain = new FrameLayout { BackgroundColor = 0x00000000 }; - dialog.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender11, e11) => - { - dialog.Close(); - }; - - var sidelipFrameLayout = new FrameLayout() - { - Width = Application.GetMinReal(449), - Y = Application.GetRealHeight(161), - X = Application.GetRealWidth(596), - BackgroundImagePath = "DoorLock/SideslipPic.png", - }; - flMain.AddChidren(sidelipFrameLayout); - - var btnSelectFloor = new Button() - { - Width = Application.GetRealWidth(200), - Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(81), - Y = Application.GetRealHeight(81), - TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, - TextSize = 14, - IsBold = true, - TextAlignment = TextAlignment.CenterLeft, - TextID = R.MyInternationalizationString.SelectFloor, - }; - sidelipFrameLayout.AddChidren(btnSelectFloor); - - var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout() - { - Y = btnSelectFloor.Bottom + Application.GetRealHeight(45), - Height = Application.GetRealHeight(600), - }; - sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); - - Button oldbutton = null; - Button oldbuttonText = null; - int count = 0; - foreach (var floorId in dicFloorList.Keys) - { - var rowFrameLayout = new RowLayout() - { - Height = Application.GetRealHeight(152), - LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, - X = Application.GetRealWidth(81), - }; - sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout); - - var btnAllMethod = new Button() - { - Width = Application.GetMinReal(81), - Height = Application.GetMinReal(81), - UnSelectedImagePath = "Floor/Floor.png", - SelectedImagePath = "Floor/FloorSelected.png", - Gravity = Gravity.CenterVertical, - }; - rowFrameLayout.AddChidren(btnAllMethod); - - var btnMethodText = new Button() - { - Width = Application.GetRealWidth(311), - Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(92), - Gravity = Gravity.CenterVertical, - TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, - TextSize = 14, - TextAlignment = TextAlignment.CenterLeft, - Text = dicFloorList[floorId], - }; - rowFrameLayout.AddChidren(btnMethodText); - - if (curControlDev.currentSelectFloorId == floorId) - { - btnAllMethod.IsSelected = true; - btnAllMethod.IsBold = true; - btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } - - string curFloorId = floorId; - EventHandler<MouseEventArgs> hander = (sender, e) => - { - if (curControlDev.currentSelectFloorId == curFloorId) - { - return; - } - curControlDev.currentSelectFloorId = curFloorId; - btnFloorText.Text = dicFloorList[floorId]; - - //鑾峰彇妤煎眰涓埧闂村垪琛� - supportRoomList = GetFloorRoomList(); - if (!btnMethodText.IsSelected) - { - if (oldbutton != null) - { - oldbutton.IsSelected = false; - } - if (oldbuttonText != null) - { - oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; - } - oldbutton = btnMethodText; - oldbuttonText = btnMethodText; - btnMethodText.IsSelected = true; - oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - oldbuttonText.IsBold = true; - } - - int index = 0; - RefreshRoomList(); - dialog.Close(); - }; - btnAllMethod.MouseUpEventHandler += hander; - rowFrameLayout.MouseUpEventHandler += hander; - btnMethodText.MouseUpEventHandler += hander; - count++; - } - - if (count == 0) - { - sidelipFrameLayout.Height = 0; - } - else if (count <= 4 && count > 0) - { - sidelipFrameLayout.Height = Application.GetRealHeight(180) + count * Application.GetRealHeight(150); - } - else - { - sidelipFrameLayout.Height = Application.GetMinReal(780); - } - } #endregion #region 鏁版嵁澶勭悊 @@ -722,10 +664,12 @@ //鑾峰彇妤煎眰 dicFloorList = HdlRoomLogic.Current.GetFloorSortList(); //鑾峰彇妤煎眰涓埧闂村垪琛� - supportRoomList = GetFloorRoomList(); + supportRoomList = BindInfo.GetFloorRoomList(); //鑾峰彇鎵�鏈夋埧闂翠腑鍖归厤鐨勮兘缁戠殑鐩爣 - currentPanelSupportBindDeviceList = GetAllRoomSupportDeviceList(); + currentPanelSupportBindDeviceList = BindInfo.GetAllRoomSupportDeviceList(currentPanelSupportBindDeviceList, supportRoomList, curDeviceBindType); + //鑾峰彇鏈湴鏈垎閰嶇殑鏀寔褰撳墠绫诲瀷鐨勭粦瀹氳澶囧垪琛� + undistruibuteDevList = BindInfo.GetUndistributeDeviceList(undistruibuteDevList, curDeviceBindType); //鑾峰彇闈㈡澘涓瓨鍦ㄧ殑缁戝畾鐩爣 var panelBindListRes = HdlDeviceBindLogic.Current.GetDeviceBindAsync(curControlDev); @@ -749,87 +693,36 @@ targetList.Clear(); //閫変腑鐩爣鍒楄〃 targetList - if (currentPanelSupportBindDeviceList.Count != 0 && curControlDev.bindList.Count != 0) + if (curControlDev.bindList.Count != 0) { foreach (var bindDev in curControlDev.bindList) { var mainKey = bindDev.BindMacAddr + bindDev.BindEpoint; - var dev = currentPanelSupportBindDeviceList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == mainKey)); - if (dev != null) + + //鍒嗛厤鐨勭洰鏍囧垪琛� + if (currentPanelSupportBindDeviceList.Count != 0) { - var device = LocalDevice.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); - if (device != null) + var dev = currentPanelSupportBindDeviceList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == mainKey)); + if (dev != null) { - switch (curDeviceBindType) + var device = LocalDevice.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); + if (device != null) { - case 1: - //鑾峰彇璁惧绫诲瀷鐨� - var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); - //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず - if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) - { - continue; - } - if (device.Type == DeviceType.FreshAir) - { - targetList.Add(device); - oldTargetList.Add(device); - } - break; - case 2: - if (device.Type == DeviceType.TemperatureSensor) - { - var bDev = device as TemperatureSensor; - if (bDev.SensorDiv == 1) - { - targetList.Add(device); - oldTargetList.Add(device); - } - } - if (device.Type == DeviceType.PMSensor) - { - if (bindDev.BindCluster == 1026) - { - targetList.Add(device); - oldTargetList.Add(device); - } - } - break; - case 3: - if (device.Type == DeviceType.TemperatureSensor) - { - var bDev = device as TemperatureSensor; - if (bDev.SensorDiv == 2) - { - targetList.Add(device); - oldTargetList.Add(device); - } - } - if (device.Type == DeviceType.FreshAirHumiditySensor) - { - targetList.Add(device); - oldTargetList.Add(device); - } - if (device.Type == DeviceType.PMSensor) - { - if (bindDev.BindCluster == 1029) - { - targetList.Add(device); - oldTargetList.Add(device); - } - } - break; - case 4: - //PM2.5 - if (device.Type == DeviceType.PMSensor) - { - if (bindDev.BindCluster == 1066) - { - targetList.Add(device); - oldTargetList.Add(device); - } - } - break; + BindTypeTargetsList(device, bindDev); + } + } + } + + //鏈垎閰嶇殑鐩爣鍒楄〃 + if (undistruibuteDevList.Count != 0) + { + var dev = undistruibuteDevList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == mainKey)); + if (dev != null) + { + var device = LocalDevice.Current.GetDevice(dev.DeviceAddr, dev.DeviceEpoint); + if (device != null) + { + BindTypeTargetsList(device, bindDev); } } @@ -845,6 +738,16 @@ { Application.RunOnMainThread(() => { + BindDownFrameLayout(this.midFrameLayout, curControlDev, dicFloorList, ref btnFloorText); + ChooseFloorAction += (floorId, btnMethodText) => + { + btnFloorText.Text = dicFloorList[floorId]; + //鑾峰彇妤煎眰涓埧闂村垪琛� + supportRoomList = BindInfo.GetFloorRoomList(); + //鑾峰彇鏈湴鏈垎閰嶇殑鏀寔褰撳墠绫诲瀷鐨勭粦瀹氳澶囧垪琛� + undistruibuteDevList = BindInfo.GetUndistributeDeviceList(undistruibuteDevList, curDeviceBindType); + RefreshRoomList(); + }; //棣栨鏄惁鑳界偣鍑讳繚瀛� if (targetList.Count == 0) @@ -865,7 +768,7 @@ { foreach (var dev in targetList) { - //鑾峰彇鏈湴璁惧鍒楄〃 + //鑾峰彇鏈湴璁惧鍒楄〃 var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == dev.DeviceAddr && obj.DeviceEpoint == dev.DeviceEpoint); if (tempDev != null) @@ -876,6 +779,10 @@ { curControlDev.currentSelectRoomId = tempDevRoom.Id; curControlDev.currentSelectFloorId = tempDevRoom.FloorId; + } + else + { + curControlDev.currentSelectRoomId = "UndistributedId"; } } } @@ -934,23 +841,36 @@ removeDevice.BindType = 0; switch (curDeviceBindType) { - case 1: + case BindInfo.BindType.FreshAir: removeDevice.BindCluster = 514; break; - case 2: + case BindInfo.BindType.Temperature: removeDevice.BindCluster = 1026; break; - case 3: + case BindInfo.BindType.Humidity: removeDevice.BindCluster = 1029; break; - case 4: - //PM2.5 + case BindInfo.BindType.PM: removeDevice.BindCluster = 1066; + break; + case BindInfo.BindType.AC: + removeDevice.BindCluster = 513;//Ac闇�瑕佺粦瀹�2涓皣513鍜�514 break; } removeDevice.BindMacAddr = bd.DeviceAddr; removeDevice.BindEpoint = bd.DeviceEpoint; delDevice.RemoveBindList.Add(removeDevice); + + if (curDeviceBindType == BindInfo.BindType.AC) + { + //瑕佺Щ闄ょ┖璋冿細闇�瑕佺Щ闄�513锛�514 + var removeDevice3 = new RemoveBindListObj(); + removeDevice3.BindCluster = 514; + removeDevice3.BindType = 0; + removeDevice3.BindMacAddr = bd.DeviceAddr; + removeDevice3.BindEpoint = bd.DeviceEpoint; + delDevice.RemoveBindList.Add(removeDevice3); + } var delResult = new DelDeviceBindResponseAllData(); delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice); @@ -973,35 +893,9 @@ { foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList) { - if (d.Result == 1) + if (d.Result == 0 || d.Result == 1) { - switch (curDeviceBindType) - { - case 1: - if (actionFreshAirTarget != null) - { - actionFreshAirTarget(""); - } - break; - case 2: - if (actionTemperatureTarget != null) - { - actionTemperatureTarget(""); - } - break; - case 3: - if (actionHumidityTarget != null) - { - actionHumidityTarget(""); - } - break; - case 4: - if (actionPMTarget != null) - { - actionPMTarget(""); - } - break; - } + EmptyTargesMess(); Application.RunOnMainThread(() => { CommonPage.Loading.Hide(); @@ -1028,33 +922,7 @@ { if (delResult.removeBindResultResponseData.Result == 0) { - switch (curDeviceBindType) - { - case 1: - if (actionFreshAirTarget != null) - { - actionFreshAirTarget(""); - } - break; - case 2: - if (actionTemperatureTarget != null) - { - actionTemperatureTarget(""); - } - break; - case 3: - if (actionHumidityTarget != null) - { - actionHumidityTarget(""); - } - break; - case 4: - if (actionPMTarget != null) - { - actionPMTarget(""); - } - break; - } + EmptyTargesMess(); Application.RunOnMainThread(() => { CommonPage.Loading.Hide(); @@ -1081,19 +949,33 @@ } else { - //娌℃湁鐩爣鎻愮ず - Application.RunOnMainThread(() => + if (btnTipPic.IsSelected) { - var myTip = new Tip(); - myTip.Direction = AMPopTipDirection.None; - myTip.CloseTime = 2; - myTip.Text = Language.StringByID(R.MyInternationalizationString.BindDeviceTargetIsEmpty); - myTip.Show(Common.CommonPage.Instance); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - CommonPage.Loading.Hide(); - }); - return; + EmptyTargesMess(); + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + this.RemoveFromParent(); + }); + } + else + { + //娌℃湁鐩爣鎻愮ず + Application.RunOnMainThread(() => + { + var myTip = new Tip(); + myTip.Direction = AMPopTipDirection.None; + myTip.CloseTime = 2; + myTip.Text = Language.StringByID(R.MyInternationalizationString.BindDeviceTargetIsEmpty); + myTip.Show(Common.CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } } } catch (Exception ex) @@ -1111,7 +993,7 @@ { //閫変腑鐩爣 //1銆佸凡缁忕粦瀹氳繃鐨勭洰鏍� - if (checkExistDevice()) + if (BindInfo.checkExistDevice(targetList, oldTargetList)) { Application.RunOnMainThread(() => { @@ -1160,7 +1042,7 @@ { foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList) { - if (d.Result != 1) + if (d.Result != 0 && d.Result != 1) { Application.RunOnMainThread(() => { @@ -1220,7 +1102,7 @@ { foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList) { - if (d.Result != 1) + if (d.Result != 0 && d.Result != 1) { Application.RunOnMainThread(() => { @@ -1262,18 +1144,20 @@ var addBindInfo = new AddBindListObj(); switch (curDeviceBindType) { - case 1: + case BindInfo.BindType.FreshAir: addBindInfo.BindCluster = 514; break; - case 2: + case BindInfo.BindType.Temperature: addBindInfo.BindCluster = 1026; break; - case 3: + case BindInfo.BindType.Humidity: addBindInfo.BindCluster = 1029; break; - case 4: - //PM2.5 + case BindInfo.BindType.PM: addBindInfo.BindCluster = 1066; + break; + case BindInfo.BindType.AC: + addBindInfo.BindCluster = 513; break; } addBindInfo.BindType = 0; @@ -1282,17 +1166,31 @@ addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de); switch (curDeviceBindType) { - case 2: + case BindInfo.BindType.Temperature: if (de.Type == DeviceType.PMSensor) { addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); } break; - case 3: + case BindInfo.BindType.Humidity: if (de.Type == DeviceType.PMSensor) { addBindeDev.BindName = Common.LocalDevice.Current.GetDeviceEpointName(de) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); } + break; + } + + //閮ㄥ垎鐩爣闇�瑕佷簩娆$粦瀹氱浜岀鍔熻兘 + var addBindInfo2 = new AddBindListObj(); + addBindInfo2.BindType = 0; + addBindInfo2.BindMacAddr = de.DeviceAddr; + addBindInfo2.BindEpoint = de.DeviceEpoint; + switch (curDeviceBindType) + { + case BindInfo.BindType.AC: + //瑕佺粦瀹氱┖璋冿細闇�瑕佺粦瀹�513锛�514 + addBindInfo2.BindCluster = 514; + addBindeDev.BindList.Add(addBindInfo2); break; } addBindeDev.BindList.Add(addBindInfo); @@ -1316,30 +1214,37 @@ if (dev.addedDeviceBindResponseData.Result == 0) { targetList.Clear(); + targetListTemp.Clear(); switch (curDeviceBindType) { - case 1: + case BindInfo.BindType.FreshAir: if (actionFreshAirTarget != null) { actionFreshAirTarget(addBindeDev.BindName); } break; - case 2: + case BindInfo.BindType.Temperature: if (actionTemperatureTarget != null) { actionTemperatureTarget(addBindeDev.BindName); } break; - case 3: + case BindInfo.BindType.Humidity: if (actionHumidityTarget != null) { actionHumidityTarget(addBindeDev.BindName); } break; - case 4: + case BindInfo.BindType.PM: if (actionPMTarget != null) { actionPMTarget(addBindeDev.BindName); + } + break; + case BindInfo.BindType.AC: + if (actionAcTarget != null) + { + actionAcTarget(addBindeDev.BindName); } break; } @@ -1356,6 +1261,8 @@ { Application.RunOnMainThread(() => { + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; CommonPage.Loading.Hide(); new Tip() { @@ -1365,8 +1272,7 @@ CloseTime = 1 }.Show(CommonPage.Instance); }); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + return; } else @@ -1402,6 +1308,139 @@ } /// <summary> + /// 鐩爣涓虹┖鏃剁殑鏂囨湰鏄剧ず + /// </summary> + void EmptyTargesMess() + { + switch (curDeviceBindType) + { + case BindInfo.BindType.FreshAir: + if (actionFreshAirTarget != null) + { + actionFreshAirTarget(""); + } + break; + case BindInfo.BindType.Temperature: + if (actionTemperatureTarget != null) + { + actionTemperatureTarget(""); + } + break; + case BindInfo.BindType.Humidity: + if (actionHumidityTarget != null) + { + actionHumidityTarget(""); + } + break; + case BindInfo.BindType.PM: + if (actionPMTarget != null) + { + actionPMTarget(""); + } + break; + case BindInfo.BindType.AC: + if (actionAcTarget != null) + { + actionAcTarget(""); + } + break; + } + } + + /// <summary> + /// 缁戝畾鐩爣鍒楄〃 + /// </summary> + /// <param name="device"></param> + /// <param name="bindDev"></param> + void BindTypeTargetsList(CommonDevice device, BindListResponseObj bindDev) + { + switch (curDeviceBindType) + { + case BindInfo.BindType.FreshAir: + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + if (device.Type == DeviceType.FreshAir) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + break; + case BindInfo.BindType.Temperature: + if (device.Type == DeviceType.TemperatureSensor) + { + var bDev = device as TemperatureSensor; + if (bDev.SensorDiv == 1) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + if (device.Type == DeviceType.PMSensor) + { + if (bindDev.BindCluster == 1026) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + break; + case BindInfo.BindType.Humidity: + if (device.Type == DeviceType.TemperatureSensor) + { + var bDev = device as TemperatureSensor; + if (bDev.SensorDiv == 2) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + if (device.Type == DeviceType.FreshAirHumiditySensor) + { + targetList.Add(device); + oldTargetList.Add(device); + } + if (device.Type == DeviceType.PMSensor) + { + if (bindDev.BindCluster == 1029) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + break; + case BindInfo.BindType.PM: + if (device.Type == DeviceType.PMSensor) + { + if (bindDev.BindCluster == 1066) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + break; + case BindInfo.BindType.AC: + if (device.Type == DeviceType.Thermostat) + { + if (bindDev.BindCluster == 513) + { + targetList.Add(device); + oldTargetList.Add(device); + } + } + break; + } + targetListTemp.Clear(); + foreach (var d in targetList) + { + targetListTemp.Add(d); + } + } + + /// <summary> /// 褰撳墠琚粦瀹氳澶囨墍灞炴ゼ灞傚拰鎴块棿 /// </summary> /// <param name="bindDev"></param> @@ -1411,7 +1450,7 @@ { return; } - //鑾峰彇鏈湴璁惧鍒楄〃 + //鑾峰彇鏈湴璁惧鍒楄〃 var localDeviceList = Shared.Common.LocalDevice.Current.listAllDevice; var tempDev = localDeviceList.Find(obj => obj.DeviceAddr == bindDev.DeviceAddr && obj.DeviceEpoint == bindDev.DeviceEpoint); if (tempDev != null) @@ -1424,29 +1463,6 @@ curControlDev.currentSelectFloorId = tempDevRoom.FloorId; } } - } - - /// <summary> - /// 妫�娴嬬洰鏍囨槸鍚﹁缁戝畾杩� - /// </summary> - /// <returns></returns> - private bool checkExistDevice() - { - bool exist = false; - foreach (var oldDev in oldTargetList) - { - var key = oldDev.DeviceAddr + oldDev.DeviceEpoint; - var result = targetList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == key)); - if (result != null) - { - exist = true; - } - else - { - exist = false; - } - } - return exist; } /// <summary> @@ -1463,412 +1479,26 @@ removeDevice.BindType = 0; switch (curDeviceBindType) { - case 1: + case BindInfo.BindType.FreshAir: removeDevice.BindCluster = 514; break; - case 2: + case BindInfo.BindType.Temperature: removeDevice.BindCluster = 1026; break; - case 3: + case BindInfo.BindType.Humidity: removeDevice.BindCluster = 1029; break; - case 4: - //PM2.5 + case BindInfo.BindType.PM: removeDevice.BindCluster = 1066; + break; + case BindInfo.BindType.AC: + removeDevice.BindCluster = 513; break; } removeDevice.BindMacAddr = bd.DeviceAddr; removeDevice.BindEpoint = bd.DeviceEpoint; delDevice.RemoveBindList.Add(removeDevice); return delDevice; - } - - /// <summary> - /// 鑳芥樉绀虹殑鎴块棿鍒楄〃 - /// </summary> - private List<Room> GetSupportRoomList() - { - var roomTempList = new List<Room>(); - for (int i = 0; i < supportRoomList.Count; i++) - { - var room = supportRoomList[i]; - //濡傛灉鎴块棿涓哄枩鐖盵鍚庢潵鏀瑰悕涓哄父鐢ㄦ埧闂碷锛屽垯涓嶆樉绀� - if (room.IsLove == true) - { - continue; - } - - //濡傛灉鎴块棿涓病鏈夎澶囷紝鍒欎笉鏄剧ず - if (room.ListDevice.Count == 0) - { - continue; - } - else - { - List<CommonDevice> roomIncludeMatchDevice = new List<CommonDevice>(); - - //鎴块棿涓病鏈夊搴旂殑鏀寔缁戝畾鐨勭洰鏍� - switch (curDeviceBindType) - { - case 1: - foreach (var de in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(de); - - if (device != null) - { - //鑾峰彇璁惧绫诲瀷鐨� - var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); - //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず - if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) - { - continue; - } - if (device.Type == DeviceType.FreshAir) - { - roomIncludeMatchDevice.Add(device); - } - } - } - break; - case 2: - roomIncludeMatchDevice = GetMatchTemperatureSensorDevice(room); - break; - case 3: - roomIncludeMatchDevice = GetMatchHumiditySensorDevice(room); - foreach (var de in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(de); - if (device != null) - { - if (device.Type == DeviceType.FreshAirHumiditySensor) - { - roomIncludeMatchDevice.Add(device); - } - } - } - break; - case 4: - foreach (var de in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(de); - if (device != null) - { - if (device.Type == DeviceType.PMSensor) - { - roomIncludeMatchDevice.Add(device); - } - } - } - break; - } - - if (roomIncludeMatchDevice.Count == 0) - { - continue; - } - - if (!string.IsNullOrEmpty(room.FloorId)) - { - //鏈夋ゼ灞� - if (room.FloorId == curControlDev.currentSelectFloorId) - { - roomTempList.Add(room); - } - } - else - { - //娌℃湁妤煎眰 - roomTempList.Add(room); - } - } - } - return roomTempList; - } - - /// <summary> - /// 鍖归厤娓╁害浼犳劅鍣� - /// </summary> - /// <param name="room"></param> - List<CommonDevice> GetMatchTemperatureSensorDevice(Room room) - { - List<CommonDevice> roomIncludeMatchTempDevice = new List<CommonDevice>(); - foreach (var de in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(de); - if (device != null) - { - //鐢垫睜璁惧涓嶆敮鎸佺粦瀹� - if (device.ZigbeeType != 1) - { - continue; - } - if (device.Type == DeviceType.TemperatureSensor) - { - var dev = device as TemperatureSensor; - if (dev.SensorDiv == 1) - { - roomIncludeMatchTempDevice.Add(device); - } - } - else if (device.Type == DeviceType.PMSensor) - { - var dev = device as PMSensor; - foreach (var clu in dev.InClusterList) - { - if (clu.InCluster == 1026) - { - roomIncludeMatchTempDevice.Add(device); - } - } - } - } - } - return roomIncludeMatchTempDevice; - } - - /// <summary> - /// 鍖归厤婀垮害浼犳劅鍣� - /// </summary> - /// <param name="room"></param> - List<CommonDevice> GetMatchHumiditySensorDevice(Room room) - { - List<CommonDevice> roomIncludeMatchHumpDevice = new List<CommonDevice>(); - foreach (var de in room.ListDevice) - { - var device = LocalDevice.Current.GetDevice(de); - if (device != null) - { - //鐢垫睜璁惧涓嶆敮鎸佺粦瀹� - if (device.ZigbeeType != 1) - { - continue; - } - if (device.Type == DeviceType.TemperatureSensor) - { - var dev = device as TemperatureSensor; - if (dev.SensorDiv == 2) - { - roomIncludeMatchHumpDevice.Add(device); - } - } - else if (device.Type == DeviceType.PMSensor) - { - var dev = device as PMSensor; - foreach (var clu in dev.InClusterList) - { - if (clu.InCluster == 1029) - { - roomIncludeMatchHumpDevice.Add(device); - } - } - } - } - } - return roomIncludeMatchHumpDevice; - } - - /// <summary> - /// 鑾峰彇妤煎眰瀵瑰簲鐨勬埧闂村垪琛� - /// </summary> - /// <returns></returns> - private List<Room> GetFloorRoomList() - { - supportRoomList.Clear(); - var supportRoomListTemp = new List<Room>(); - var listAllRoom = HdlRoomLogic.Current.GetAllListRooms(); - if (Common.Config.Instance.Home.FloorDics.Count == 0) - { - // 鑾峰彇娌℃湁妤煎眰鎴块棿 - foreach (var room in listAllRoom) - { - if (string.IsNullOrEmpty(room.FloorId)) - { - if (room.IsLove) - { - continue; - } - supportRoomListTemp.Add(room); - } - } - } - else - { - // 鑾峰彇鏀寔鐨勬埧闂� - foreach (var room in listAllRoom) - { - if (room.IsLove) - { - continue; - } - supportRoomListTemp.Add(room); - } - } - return supportRoomListTemp; - } - - /// <summary> - /// 鎵�鏈夋埧闂翠腑鍖归厤鐨勬敮鎸佺粦瀹氱殑鎵�鏈夌洰鏍囧垪琛� - /// </summary> - /// <returns></returns> - List<CommonDevice> GetAllRoomSupportDeviceList() - { - currentPanelSupportBindDeviceList.Clear(); - List<CommonDevice> currentPanelBindSupportDeviceListTemp = new List<CommonDevice>(); - switch (curDeviceBindType) - { - case 1: - foreach (var r in supportRoomList) - { - if (r.ListDevice.Count == 0) - { - continue; - } - foreach (var deviceKeys in r.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device != null) - { - //鑾峰彇璁惧绫诲瀷鐨� - var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); - //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず - if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) - { - continue; - } - if (device.Type == DeviceType.FreshAir) - { - currentPanelBindSupportDeviceListTemp.Add(device); - } - } - } - } - break; - case 2: - foreach (var r in supportRoomList) - { - if (r.ListDevice.Count == 0) - { - continue; - } - var deviceListTemp = GetMatchTemperatureSensorDevice(r); - foreach (var dev in deviceListTemp) - { - currentPanelBindSupportDeviceListTemp.Add(dev); - } - } - break; - case 3: - foreach (var r in supportRoomList) - { - if (r.ListDevice.Count == 0) - { - continue; - } - var deviceListTemp = GetMatchHumiditySensorDevice(r); - foreach (var dev in deviceListTemp) - { - currentPanelBindSupportDeviceListTemp.Add(dev); - } - foreach (var deviceKeys in r.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device != null) - { - if (device.Type == DeviceType.FreshAirHumiditySensor) - { - currentPanelBindSupportDeviceListTemp.Add(device); - } - } - } - } - break; - case 4: - foreach (var r in supportRoomList) - { - if (r.ListDevice.Count == 0) - { - continue; - } - foreach (var deviceKeys in r.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device != null) - { - if (device.Type == DeviceType.PMSensor) - { - currentPanelBindSupportDeviceListTemp.Add(device); - } - } - } - } - break; - } - return currentPanelBindSupportDeviceListTemp; - } - - /// <summary> - /// 鑾峰彇褰撳墠鎴块棿涓尮閰嶇殑鏀寔缁戝畾鐨勮澶囧垪琛� - /// </summary> - /// <returns></returns> - List<CommonDevice> GetCurRoomSupportDeviceList(Room curRoom) - { - currentRoomSupportBindDeviceList.Clear(); - List<CommonDevice> curRoomDeviceListTemp = new List<CommonDevice>(); - switch (curDeviceBindType) - { - case 1: - foreach (var deviceKeys in curRoom.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device != null) - { - //鑾峰彇璁惧绫诲瀷鐨� - var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); - //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず - if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) - { - continue; - } - if (device.Type == DeviceType.FreshAir) - { - curRoomDeviceListTemp.Add(device); - } - } - } - break; - case 2: - curRoomDeviceListTemp = GetMatchTemperatureSensorDevice(curRoom); - break; - case 3: - curRoomDeviceListTemp = GetMatchHumiditySensorDevice(curRoom); - foreach (var deviceKeys in curRoom.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device != null) - { - if (device.Type == DeviceType.FreshAirHumiditySensor) - { - curRoomDeviceListTemp.Add(device); - } - } - } - break; - case 4: - foreach (var deviceKeys in curRoom.ListDevice) - { - var device = LocalDevice.Current.GetDevice(deviceKeys); - if (device != null) - { - if (device.Type == DeviceType.PMSensor) - { - curRoomDeviceListTemp.Add(device); - } - } - } - break; - } - return curRoomDeviceListTemp; } #endregion @@ -1882,9 +1512,9 @@ actionTemperatureTarget = null; actionHumidityTarget = null; actionPMTarget = null; + FloorAction = null; base.RemoveFromParent(); } #endregion } } - -- Gitblit v1.8.0