From 07c647861d549a4c61f615dba9c008c29ad57f43 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期三, 02 九月 2020 15:57:58 +0800 Subject: [PATCH] 2020-09-02-1 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelSimpleEnvironmentButtonSettionForm.cs | 405 +++++++++++++++++++++++++++++---------------------------- 1 files changed, 209 insertions(+), 196 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelSimpleEnvironmentButtonSettionForm.cs similarity index 68% rename from ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs rename to ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelSimpleEnvironmentButtonSettionForm.cs index 346a4fe..9382623 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFreshAirButtonSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelSimpleEnvironmentButtonSettionForm.cs @@ -1,15 +1,16 @@ 锘縰sing System; using System.Collections.Generic; using Shared.Common; +using Shared.Phone.UserCenter.Device.Bind; using ZigBee.Common; using ZigBee.Device; namespace Shared.Phone.UserCenter.DevicePanel { /// <summary> - /// 鏂规偊鏂伴闈㈡澘鐨勬寜閿厤缃晫闈� + /// 闈㈡澘鐨勬寜閿厤缃晫闈€�愯绫绘殏鏃惰垗寮冦�� /// </summary> - public class PanelFangyueFreshAirButtonSettionForm : EditorCommonForm + public class PanelSimpleEnvironmentButtonSettionForm : EditorCommonForm { #region 鈻� 鍙橀噺澹版槑___________________________ @@ -36,7 +37,7 @@ /// <summary> /// PM鐩爣鍚嶅瓧 /// </summary> - private string bindPmName = string.Empty; + private string bindAcName = string.Empty; /// <summary> /// 琚粦鐩爣鏄柊椋� /// </summary> @@ -50,9 +51,9 @@ /// </summary> private CommonDevice bindHumidityDev; /// <summary> - /// 琚粦鐩爣鏄疨M2.5 + /// 琚粦鐩爣鏄┖璋� /// </summary> - private CommonDevice bindPMDev; + private CommonDevice bindAcDev; // <summary> /// 鎸夐敭涓缁戝畾鐨勭洰鏍囧垪琛� /// </summary> @@ -70,7 +71,7 @@ { this.deviceObj = i_device; //鑾峰彇鏁版嵁 - ReadDoorLockUserInfo(deviceObj); + InitInfo(deviceObj); //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uPanelSettion)); @@ -97,7 +98,7 @@ //鍥剧墖 var btnPic = new PicViewControl(426, 426); btnPic.Y = Application.GetRealHeight(150); - btnPic.UnSelectedImagePath = "RealDevice/ButtonPanelFangyueFreshAir.png"; + btnPic.UnSelectedImagePath = "RealDevice/ButtonPanelSimpleEnvironment.png"; btnPic.Gravity = Gravity.CenterHorizontal; listBackControl.frameTable.AddChidren(btnPic); @@ -128,11 +129,11 @@ /// </summary> private void InitMenuRow() { - this.listview.RemoveAll(); + this.listview.RemoveAll(); + //Ac鏉ユ簮 + this.AddAcRow(); //娣诲姞鏂伴鐩爣 this.AddFreshAirRow(); - //PM2.5鏉ユ簮 - this.AddPMRow(); //娣诲姞娓╁害鏉ユ簮 this.AddTemperatureSensorRow(); //娣诲姞婀垮害鏉ユ簮 @@ -142,12 +143,11 @@ } #endregion - #region 鈻� 鍒濆鍖栨暟鎹甠________________________ - + #region 鈻� 鏁版嵁澶勭悊_________________________ /// <summary> /// 鍒濆鍖栨暟鎹� /// </summary> - void ReadDoorLockUserInfo(CommonDevice curControlDev) + void InitInfo(CommonDevice curControlDev) { System.Threading.Tasks.Task.Run(async () => { @@ -164,7 +164,7 @@ Application.RunOnMainThread(() => { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime) + "(" + "5007" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); }); } } @@ -181,6 +181,181 @@ }); } }); + } + + /// <summary> + /// 鑾峰彇缁戝畾鐩爣 + /// </summary> + /// <param name="curControlDev"></param> + /// <returns></returns> + private async System.Threading.Tasks.Task<bool> GetBindName(CommonDevice curDev) + { + bool result = false; + //鑾峰彇闈㈡澘涓瓨鍦ㄧ殑缁戝畾鐩爣 + var curControlDev = new CommonDevice(); + curControlDev.DeviceAddr = curDev.DeviceAddr; + curControlDev.CurrentGateWayId = curDev.CurrentGateWayId; + curControlDev.Type = curDev.Type; + int count = 0; + for (int i = 1; i < 3; i++) + { + curControlDev.DeviceEpoint = i; + + var panelBindListRes = HdlDeviceBindLogic.Current.GetDeviceBindAsync(curControlDev); + if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null) + { + bindList = panelBindListRes.getAllBindResponseData.BindList; + foreach (var bDev in bindList) + { + var device = Common.LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint); + if (device == null) + { + continue; + } + if (device.Type == DeviceType.FreshAir) + { + //鑾峰彇璁惧绫诲瀷鐨� + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) + { + continue; + } + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindFreshAirName = Common.LocalDevice.Current.GetDeviceEpointName(device); + } + else + { + bindFreshAirName = bDev.ESName; + } + + bindFreshAirDev = device; + } + else if (device.Type == DeviceType.TemperatureSensor) + { + var bD = device as TemperatureSensor; + if (bD.SensorDiv == 1) + { + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device); + } + else + { + bindTemperatureName = bDev.ESName; + } + bindTemperatureDev = device; + } + if (bD.SensorDiv == 2) + { + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device); + } + else + { + bindHumidityName = bDev.ESName; + } + + bindHumidityDev = device; + } + } + else if (device.Type == DeviceType.FreshAirHumiditySensor) + { + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device); + } + else + { + bindHumidityName = bDev.ESName; + } + + bindHumidityDev = device; + } + else if (device.Type == DeviceType.Thermostat) + { + if (string.IsNullOrEmpty(bDev.ESName)) + { + bindAcName = Common.LocalDevice.Current.GetDeviceEpointName(device); + } + else + { + bindAcName = bDev.ESName; + } + + bindAcDev = device; + } + else if (device.Type == DeviceType.PMSensor) + { + if (bDev.BindCluster == 1026) + { + bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); + bindTemperatureDev = device; + } + if (bDev.BindCluster == 1029) + { + bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); + bindHumidityDev = device; + } + } + } + count++; + if (count == 2) + { + result = true; + } + } + } + + return result; + } + #endregion + + #region 鈻� Ac鏉ユ簮_________________________ + /// <summary> + /// Ac鏉ユ簮琛� + /// </summary> + private void AddAcRow() + { + //Ac + var rowAc = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(rowAc); + rowAc.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.AcTargets), 600); + //搴曠嚎 + rowAc.AddBottomLine(); + //鍙崇澶� + rowAc.AddRightArrow(); + var msg = Language.StringByID(R.MyInternationalizationString.nothing); + if (!string.IsNullOrEmpty(bindAcName)) + { + msg = bindAcName; + } + var btnAcStatu = rowAc.AddMostRightView(msg, 700); + rowAc.ButtonClickEvent += (sender, e) => + { + this.deviceObj.DeviceEpoint = 1; + var paneTargetsBaseFormp = new PaneTargetsBaseForm(this.deviceObj, bindAcDev, DeviceBind.BindInfo.BindType.AC); + Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + paneTargetsBaseFormp.Show(); + + paneTargetsBaseFormp.actionAcTarget += (bindName) => + { + Application.RunOnMainThread(() => + { + if (string.IsNullOrEmpty(bindName)) + { + btnAcStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing); + } + else + { + btnAcStatu.Text = bindName; + } + }); + }; + }; } #endregion @@ -207,13 +382,13 @@ var btnNewWindStatu = rowNewWind.AddMostRightView(msg, 700); rowNewWind.ButtonClickEvent += (sender, e) => - { - var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindFreshAirDev, 1); - Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); + { + this.deviceObj.DeviceEpoint = 2; + var paneTargetsBaseFormp = new PaneTargetsBaseForm(this.deviceObj, bindAcDev, DeviceBind.BindInfo.BindType.FreshAir); + Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - addDevicePage.Show(); - - addDevicePage.actionFreshAirTarget += (bindName) => + paneTargetsBaseFormp.Show(); + paneTargetsBaseFormp.actionFreshAirTarget += (bindName) => { Application.RunOnMainThread(() => { @@ -228,163 +403,6 @@ }); }; - }; - } - #endregion - - /// <summary> - /// 鑾峰彇缁戝畾鐩爣 - /// </summary> - /// <param name="curControlDev"></param> - /// <returns></returns> - private async System.Threading.Tasks.Task<bool> GetBindName(CommonDevice curDev) - { - bool result = false; - //鑾峰彇闈㈡澘涓瓨鍦ㄧ殑缁戝畾鐩爣 - FreshAir curControlDev = curDev as FreshAir; - var panelBindListRes = HdlDeviceBindLogic.Current.GetDeviceBindAsync(curControlDev); - if (panelBindListRes != null && panelBindListRes.getAllBindResponseData != null) - { - bindList = panelBindListRes.getAllBindResponseData.BindList; - foreach (var bDev in bindList) - { - var device = Common.LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint); - - if (device.Type == DeviceType.FreshAir) - { - //鑾峰彇璁惧绫诲瀷鐨� - var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); - //鏂伴闈㈡澘鐨勬柊椋庤澶囷紝鍒欎笉鏄剧ず - if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir) - { - continue; - } - if (string.IsNullOrEmpty(bDev.ESName)) - { - bindFreshAirName = Common.LocalDevice.Current.GetDeviceEpointName(device); - } - else - { - bindFreshAirName = bDev.ESName; - } - - bindFreshAirDev = device; - } - if (device.Type == DeviceType.TemperatureSensor) - { - var bD = device as TemperatureSensor; - if (bD.SensorDiv == 1) - { - if (string.IsNullOrEmpty(bDev.ESName)) - { - bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device); - } - else - { - bindTemperatureName = bDev.ESName; - } - bindTemperatureDev = device; - } - if (bD.SensorDiv == 2) - { - if (string.IsNullOrEmpty(bDev.ESName)) - { - bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device); - } - else - { - bindHumidityName = bDev.ESName; - } - - bindHumidityDev = device; - } - } - if (device.Type == DeviceType.FreshAirHumiditySensor) - { - if (string.IsNullOrEmpty(bDev.ESName)) - { - bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device); - } - else - { - bindHumidityName = bDev.ESName; - } - - bindHumidityDev = device; - } - if (device.Type == DeviceType.PMSensor) - { - if (bDev.BindCluster == 1026) - { - bindTemperatureName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor); - bindTemperatureDev = device; - } - if (bDev.BindCluster == 1029) - { - bindHumidityName = Common.LocalDevice.Current.GetDeviceEpointName(device) + "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor); - bindHumidityDev = device; - } - if (bDev.BindCluster == 1066) - { - if (string.IsNullOrEmpty(bDev.ESName)) - { - bindPmName = Common.LocalDevice.Current.GetDeviceEpointName(device); - } - else - { - bindPmName = bDev.ESName; - } - - bindPMDev = device; - } - } - } - result = true; - } - return result; - } - - #region 鈻� PM2.5鏉ユ簮_________________________ - /// <summary> - /// PM2.5鏉ユ簮琛� - /// </summary> - private void AddPMRow() - { - //PM2.5 - var rowPM = new FrameRowControl(listview.rowSpace / 2); - listview.AddChidren(rowPM); - rowPM.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.PM25Source), 600); - //搴曠嚎 - rowPM.AddBottomLine(); - //鍙崇澶� - rowPM.AddRightArrow(); - var msg = Language.StringByID(R.MyInternationalizationString.nothing); - if (!string.IsNullOrEmpty(bindPmName)) - { - msg = bindPmName; - } - var btnPMStatu = rowPM.AddMostRightView(msg, 700); - rowPM.ButtonClickEvent += (sender, e) => - { - var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindPMDev, 4); - Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - addDevicePage.Show(); - - addDevicePage.actionPMTarget += (bindName) => - { - Application.RunOnMainThread(() => - { - if (string.IsNullOrEmpty(bindName)) - { - btnPMStatu.Text = Language.StringByID(R.MyInternationalizationString.nothing); - } - else - { - btnPMStatu.Text = bindName; - } - }); - }; }; } #endregion @@ -411,12 +429,12 @@ var btnTemperatureStatu = rowTemPerature.AddMostRightView(msg, 700); rowTemPerature.ButtonClickEvent += (sender, e) => { - var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindTemperatureDev, 2); - Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); + this.deviceObj.DeviceEpoint = 1; + var paneTargetsBaseFormp = new PaneTargetsBaseForm(this.deviceObj, bindAcDev, DeviceBind.BindInfo.BindType.Temperature); + Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - addDevicePage.Show(); - - addDevicePage.actionTemperatureTarget += (bindName) => + paneTargetsBaseFormp.Show(); + paneTargetsBaseFormp.actionTemperatureTarget += (bindName) => { Application.RunOnMainThread(() => { @@ -456,12 +474,12 @@ var btnHumidityStatu = rowHumidity.AddMostRightView(msg, 700); rowHumidity.ButtonClickEvent += (sender, e) => { - var addDevicePage = new Shared.Phone.UserCenter.DeviceBind.PanelFangyueFreshAirTargetsForm(this.deviceObj, bindHumidityDev, 3); - Shared.Phone.UserView.HomePage.Instance.AddChidren(addDevicePage); + this.deviceObj.DeviceEpoint = 1; + var paneTargetsBaseFormp = new PaneTargetsBaseForm(this.deviceObj, bindAcDev, DeviceBind.BindInfo.BindType.Humidity); + Shared.Phone.UserView.HomePage.Instance.AddChidren(paneTargetsBaseFormp); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - addDevicePage.Show(); - - addDevicePage.actionHumidityTarget += (bindName) => + paneTargetsBaseFormp.Show(); + paneTargetsBaseFormp.actionHumidityTarget += (bindName) => { Application.RunOnMainThread(() => { @@ -494,14 +512,9 @@ //鍙崇澶� rowLight.AddRightArrow(); rowLight.ButtonClickEvent += (sender, e) => - { - //缁欐柊椋庨潰鏉垮缓绔嬩竴涓柊鐨勬敮鎸侀潰鏉垮璞★紝鐢�200绔偣璁剧疆 - var panel = new Panel(); - panel.DeviceAddr = this.deviceObj.DeviceAddr; - panel.DeviceEpoint = 200; - panel.CurrentGateWayId = this.deviceObj.CurrentGateWayId; - var form = new PanelFangyueFreshAirBackLightSettionForm(); - form.AddForm(panel); + { + var form = new PanelBrightnessAdjustForm(); + form.AddForm(this.deviceObj); }; } #endregion @@ -545,4 +558,4 @@ #endregion } -} +} \ No newline at end of file -- Gitblit v1.8.0