From cf0bffdf072bae11bdb8c780d0a355818700f713 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 18 五月 2020 15:42:45 +0800 Subject: [PATCH] 请合并代码,优化面板问题 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs | 99 ++++++++++--------- ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs | 70 ++++++++++++- ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs | 59 +++++++++++ ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs | 22 +++ ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs | 23 ++-- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs | 11 +- ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs | 13 ++ 7 files changed, 221 insertions(+), 76 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs index 7e3146e..f7ac7c2 100644 --- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs +++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DevicePmSensorDetailCardForm.cs @@ -156,7 +156,7 @@ framePmPic.AddChidren(btnPmStatus); this.listControl.Add(btnPmStatus); - //PM2.5鍗曚綅 + //PM2.5鍗曚綅 锛堢4涓紝listControl銆�3銆戯級 var btnPmUnit = new NormalViewControl(120 + 26, 43, true); btnPmUnit.Y = Application.GetRealHeight(181 + 46); btnPmUnit.X = Application.GetRealWidth(153); @@ -165,6 +165,23 @@ btnPmUnit.TextColor = ZigbeeColor.Current.XMWhite; btnPmUnit.TextAlignment = TextAlignment.CenterLeft; framePmPic.AddChidren(btnPmUnit); + this.listControl.Add(btnPmUnit); + + frameHumidityPic.MouseUpEventHandler += (sender, e) => + { + pMSensor.currentPmData = 35; + UpdateStatus(); + }; + frameTemperaturePic.MouseUpEventHandler += (sender, e) => + { + pMSensor.currentPmData = 99; + UpdateStatus(); + }; + framePmPic.MouseUpEventHandler += (sender, e) => + { + pMSensor.currentPmData = 100; + UpdateStatus(); + }; } #endregion @@ -261,30 +278,70 @@ if (pMSensor.currentPmData <= 35 && pMSensor.currentPmData >= 0) { curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality); + + if (pMSensor.currentPmData < 10) + { + this.listControl[2].Width = Application.GetRealWidth(193 - 70); + this.listControl[3].X = Application.GetRealWidth(180 - 70); + } + else + { + this.listControl[2].Width = Application.GetRealWidth(193 - 40); + this.listControl[3].X = Application.GetRealWidth(153 - 25); + + this.listControl[2].BackgroundColor = 0xff00ff00; + this.listControl[3].BackgroundColor = 0xff00ffff; + } } + else if (pMSensor.currentPmData <= 75 && pMSensor.currentPmData > 35) { curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality); + this.listControl[2].Width = Application.GetRealWidth(193 - 40); + this.listControl[3].X = Application.GetRealWidth(153 - 25); } else if (pMSensor.currentPmData <= 115 && pMSensor.currentPmData > 75) { curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality); + + if (pMSensor.currentPmData < 100) + { + this.listControl[2].Width = Application.GetRealWidth(193 - 40); + this.listControl[3].X = Application.GetRealWidth(153 - 25); + this.listControl[2].BackgroundColor = 0xff00ff00; + this.listControl[3].BackgroundColor = 0xff00ffff; + } + else + { + this.listControl[2].Width = Application.GetRealWidth(162); + this.listControl[3].X = Application.GetRealWidth(153); + this.listControl[2].BackgroundColor = 0xff00ff00; + this.listControl[3].BackgroundColor = 0xff00ffff; + } } else if (pMSensor.currentPmData <= 150 && pMSensor.currentPmData > 115) { curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality); + this.listControl[2].Width = Application.GetRealWidth(162); + this.listControl[3].X = Application.GetRealWidth(153); } else if (pMSensor.currentPmData <= 250 && pMSensor.currentPmData > 150) { curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality); + this.listControl[2].Width = Application.GetRealWidth(162); + this.listControl[3].X = Application.GetRealWidth(153); } else if (pMSensor.currentPmData > 250) { curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality); + this.listControl[2].Width = Application.GetRealWidth(162); + this.listControl[3].X = Application.GetRealWidth(153); } else { curQuality = ""; + this.listControl[2].Width = Application.GetRealWidth(0); + this.listControl[3].Gravity = Gravity.CenterHorizontal; } //璁剧疆鐘舵�佹枃瀛� return curQuality; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs old mode 100755 new mode 100644 index 7f5755c..ab7df40 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSceneLogic.cs @@ -63,7 +63,7 @@ } this.dicScenes[tempScene.Id] = tempScene; } - catch(Exception ex) + catch (Exception ex) { HdlLogLogic.Current.WriteLog(ex); try @@ -589,13 +589,14 @@ /// <returns></returns> public string GetZoneById(int sceneId) { - var room =HdlRoomLogic.Current.GetRoomBySceneId(sceneId); + var room = HdlRoomLogic.Current.GetRoomBySceneId(sceneId); if (room == null) { return null; } var floorName = Shared.Common.Config.Instance.Home.GetFloorNameById(room.FloorId); - if (floorName == null) + //鏇存敼浠g爜锛氬鏋渇loorName=鈥溾�濅篃瑕佸垽鏂紝鍚﹀垯鏈夆�滐紝鈥� + if (string.IsNullOrEmpty(floorName)) { return room.Name; } @@ -659,8 +660,8 @@ sceneUIs.Add(this.dicScenes[sceneId]); } } - } - + } + return sceneUIs; } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs old mode 100755 new mode 100644 index d272cde..441b86e --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddDevicePage.cs @@ -354,10 +354,12 @@ continue; } roomTempList.Add(room); - if (roomTempList.Count != 0) - { - curRoom = roomTempList[0]; - } + } + + for (int i = 0; i < roomTempList.Count; i++) + { + var room = roomTempList[i]; + curRoom = roomTempList[0]; var btnRoomFrameLayout = new FrameLayout { @@ -391,6 +393,18 @@ curentOldRoom = btnRoom; curentOldRoomFrameLayout = btnRoomFrameLayout; } + if (index == roomTempList.Count - 1 && index > 3) + { + var btnRoomFrameLayoutEmpty = new FrameLayout + { + Height = Application.GetMinReal(159), + Width = Application.GetMinReal(50), + Y = Application.GetRealHeight(23), + X = Application.GetRealWidth(5), + BorderWidth = 1, + }; + btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty); + } EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) => { if (!btnRoom.IsSelected) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs index 5414e02..19c5766 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs @@ -151,7 +151,6 @@ btnHorizontalScrolViewLayout = new HorizontalScrolViewLayout { X = Application.GetRealWidth(58), - BackgroundColor = 0xff00ff00, }; btnMidTopLayout.AddChidren(btnHorizontalScrolViewLayout); @@ -491,11 +490,11 @@ { roomTempList.Add(room); } - if (roomTempList.Count != 0) - { - curRoom = roomTempList[0]; - } - + } + for (int i = 0; i < roomTempList.Count; i++) + { + var room = roomTempList[i]; + curRoom = roomTempList[0]; var btnRoomFrameLayout = new FrameLayout { Height = Application.GetMinReal(159), @@ -528,6 +527,20 @@ curentOldRoom = btnRoom; curentOldRoomFrameLayout = btnRoomFrameLayout; } + + if (index == roomTempList.Count - 1 && index > 3) + { + var btnRoomFrameLayoutEmpty = new FrameLayout + { + Height = Application.GetMinReal(159), + Width = Application.GetMinReal(50), + Y = Application.GetRealHeight(23), + X = Application.GetRealWidth(5), + BorderWidth = 1, + }; + btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty); + } + EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) => { if (!btnRoom.IsSelected) @@ -695,48 +708,42 @@ } } - bool IsTip = false; EventHandler<MouseEventArgs> hander = (sender, e) => - { - if (currentKey.bindList.Count != 0) - { - if (IsTip) - { - return; - } - IsTip = true; - if (btnChoose.IsSelected) - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindExist), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnBindName); - return; - } - } + { + if (currentKey.bindList.Count != 0) + { + if (btnChoose.IsSelected) + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindExist), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnBindName); + return; + } + } - if (!btnChoose.IsSelected) - { - if (oldScene != null) - { - oldScene.IsSelected = false; - oldScene.Visible = false; - } - oldScene = btnChoose; - oldScene.IsSelected = true; - oldScene.Visible = true; - targetListDevice.Clear(); - targetListScene.Clear(); - targetListScene.Add(scene); - } - if (targetListDevice.Count == 0 && targetListScene.Count == 0) - { - btnFinifh.Enable = false; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; - } - else - { - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - } - }; + if (!btnChoose.IsSelected) + { + if (oldScene != null) + { + oldScene.IsSelected = false; + oldScene.Visible = false; + } + oldScene = btnChoose; + oldScene.IsSelected = true; + oldScene.Visible = true; + targetListDevice.Clear(); + targetListScene.Clear(); + targetListScene.Add(scene); + } + if (targetListDevice.Count == 0 && targetListScene.Count == 0) + { + btnFinifh.Enable = false; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; + } + else + { + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + } + }; rowLayout.MouseUpEventHandler += hander; devicePic.MouseUpEventHandler += hander; btnBindName.MouseUpEventHandler += hander; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs index 7182c20..de21c0e 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs @@ -259,7 +259,15 @@ { continue; } - bindFreshAirName = device.DeviceEpointName; + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindFreshAirName = device.DeviceEpointName; + } + else + { + bindFreshAirName = bDev.ESName; + } + bindFreshAirDev = device; } if (device.Type == DeviceType.TemperatureSensor) @@ -267,35 +275,83 @@ var bD = device as TemperatureSensor; if (bD.SensorDiv == 1) { - bindTemperatureName = device.DeviceEpointName; + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindTemperatureName = device.DeviceEpointName; + } + else + { + bindTemperatureName = bDev.ESName; + } + bindTemperatureDev = device; } if (bD.SensorDiv == 2) { - bindHumidityName = device.DeviceEpointName; + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindHumidityName = device.DeviceEpointName; + } + else + { + bindHumidityName = bDev.ESName; + } + bindHumidityDev = device; } } if (device.Type == DeviceType.FreshAirHumiditySensor) { - bindHumidityName = device.DeviceEpointName; + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindHumidityName = device.DeviceEpointName; + } + else + { + bindHumidityName = bDev.ESName; + } + bindHumidityDev = device; } if (device.Type == DeviceType.PMSensor) { if (bDev.BindCluster == 1026) { - bindTemperatureName = device.DeviceEpointName; + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindTemperatureName = device.DeviceEpointName; + } + else + { + bindTemperatureName = bDev.ESName; + } + bindTemperatureDev = device; } if (bDev.BindCluster == 1029) { - bindHumidityName = device.DeviceEpointName; + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindHumidityName = device.DeviceEpointName; + } + else + { + bindHumidityName = bDev.ESName; + } + bindHumidityDev = device; } if (bDev.BindCluster == 1066) { - bindPmName = device.DeviceEpointName; + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindPmName = device.DeviceEpointName; + } + else + { + bindPmName = bDev.ESName; + } + bindPMDev = device; } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs index 9a571e4..9e71acc 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirTargetsForm.cs @@ -342,6 +342,19 @@ } } + if (index == roomTempList.Count - 1 && index > 3) + { + var btnRoomFrameLayoutEmpty = new FrameLayout + { + Height = Application.GetMinReal(159), + Width = Application.GetMinReal(50), + Y = Application.GetRealHeight(23), + X = Application.GetRealWidth(5), + BorderWidth = 1, + }; + btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty); + } + EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) => { if (!btnRoom.IsSelected) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs index 78b98e7..3620cae 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UserDoorLockPage.cs @@ -83,7 +83,7 @@ /// <summary> /// 涓儴甯冨眬涓棬閿佸悕绉版樉绀� /// </summary> - Button btnDoorLockTitle; + NormalViewControl btnDoorLockTitle; /// <summary> /// 鍒嗕韩 /// </summary> @@ -252,18 +252,15 @@ }; this.midFrameLayout.AddChidren(midTopFrameLayout); - //闂ㄩ攣鏍囬 - btnDoorLockTitle = new Button() - { - Width = Application.GetRealWidth(250), - Height = Application.GetRealHeight(60), - X = Application.GetRealWidth(372), - Y = Application.GetRealHeight(46), - TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, - TextSize = 15, - TextAlignment = TextAlignment.Center, - IsBold = true, - }; + //璁惧鍚嶇О + btnDoorLockTitle = new NormalViewControl(100, 60, true); + btnDoorLockTitle.Y = Application.GetRealHeight(46); + btnDoorLockTitle.TextSize = 15; + btnDoorLockTitle.IsBold = true; + btnDoorLockTitle.Text = Common.LocalDevice.Current.GetDeviceMacName(doorLock); + btnDoorLockTitle.Width = btnDoorLockTitle.GetRealWidthByText(); + btnDoorLockTitle.TextAlignment = TextAlignment.Center; + btnDoorLockTitle.Gravity = Gravity.CenterHorizontal; midTopFrameLayout.AddChidren(btnDoorLockTitle); //璁板綍 -- Gitblit v1.8.0