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/UserCenter/Device/DeviceMacInfoEditorForm.cs | 234 +++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 148 insertions(+), 86 deletions(-) diff --git a/ZigbeeApp20200825/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs similarity index 92% rename from ZigbeeApp20200825/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs rename to ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs index 9a310a9..742d473 100644 --- a/ZigbeeApp20200825/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs @@ -61,11 +61,11 @@ private List<BindObj.BindListResponseObj> bindList = new List<BindObj.BindListResponseObj>(); /// <summary> /// 绠�绾﹀鍔熻兘闈㈡澘鐨勬帴杩戞劅搴旀暟鎹� - private Panel.PanelProximitySensorInfo proximitySensorsInfo = new Panel.PanelProximitySensorInfo(); - #endregion - + private Panel.PanelProximitySensorInfo proximitySensorsInfo = new Panel.PanelProximitySensorInfo(); + #endregion + #region 鈻� 鍒濆鍖朹____________________________ - + /// <summary> /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) /// </summary> @@ -77,7 +77,7 @@ { //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶� listNewDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac)); - } + } this.listDeviceType.Clear(); deviceMacTemp = deviceMac; foreach (var device in listNewDevice) @@ -110,7 +110,7 @@ var key = new ZigBee.Device.Panel(); key.DeviceAddr = deviceMac; key.CurrentGateWayId = dev.CurrentGateWayId; - InitBindInfo(key); + InitBindInfo(key); } } } @@ -142,6 +142,7 @@ string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote); string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]); var btnNote = new FrameCaptionInputControl(caption, deviceName, listview.rowSpace / 2); + btnNote.txtInput.MaxByte = 48;//闄愬埗鍙兘杈撳叆48涓瓧鑺� listview.AddChidren(btnNote); btnNote.InitControl(); //鍒掔嚎 @@ -155,6 +156,11 @@ } if (oldName != btnNote.Text) { + //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈� + if (Common.Config.Instance.Home.IsShowTemplate == true) + { + return; + } //淇敼鍚嶅瓧 this.DeviceReName(btnNote.Text, false); } @@ -176,6 +182,11 @@ rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uInstallationLocation), this.listNewDevice); //搴曠嚎 rowBeloneArea.AddBottomLine(); + //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈� + if (Common.Config.Instance.Home.IsShowTemplate == true) + { + rowBeloneArea.CanClick = false; + } var listCheck = new List<string>(); rowBeloneArea.SelectRoomEvent += (roomKeys) => @@ -248,8 +259,8 @@ this.CloseForm(); } }; - //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹呯殑璇�,璁╂墍鏈夎彍鍗曢兘涓嶈兘鐐瑰嚮 - if (Common.Config.Instance.Home.IsVirtually == true) + //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈� + if (Common.Config.Instance.Home.IsShowTemplate == true) { for (int i = 0; i < listview.ChildrenCount; i++) { @@ -295,7 +306,7 @@ //绠�绾﹀鍔熻兘闈㈡澘 this.AddIBindRow(deviceMacTemp); this.AddProximitySensorsRow(deviceMacTemp); - this.AddFunctionSettionRow(); + this.AddFunctionSettionRow(); this.AddHumiditySourceRow(deviceMacTemp); this.AddTemperatureSensorRow(deviceMacTemp); this.DataCorrectionRow(deviceMacTemp); @@ -820,14 +831,18 @@ var form = new DevicePanel.PanelFangyueFunctionSettionForm(); form.AddForm(listNewDevice[0], deviceEnumInfo); } - //绠�绾︾幆澧冮潰鏉跨殑鎸夐敭閰嶇疆 + //绠�绾﹀鍔熻兘闈㈡澘 else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction) { var form = new DeviceFunctionSettionForm(); - if (listNewDevice.Count > 62) - { - form.AddForm(listNewDevice[62], true); - } + foreach (var dev in listNewDevice) + { + if (dev.Type == DeviceType.OnOffOutput && dev.DeviceEpoint == 62) + { + form.AddForm(dev, true); + } + } + } //娌充笢鐨勯潰鏉胯澶� else if (deviceEnumInfo.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘 && deviceEnumInfo.IsHdlDevice == true) @@ -948,10 +963,17 @@ btnSwitch.IsSelected = statu; } }; + //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈� + if (Common.Config.Instance.Home.IsShowTemplate == true) + { + btnSwitch.CanClick = false; + btnSwitch.IsSelected = TemplateData.TemplateDeviceDataLogic.Current.GetCurtainHandPullControl(deviceCurtain); + return; + } //濡傛灉鏄櫄鎷熶綇瀹� if (Common.Config.Instance.Home.IsVirtually == true) { - btnSwitch.IsSelected = ModelData.DeviceModelDataLogic.Current.GetCurtainHandPullControl(deviceCurtain); + btnSwitch.IsSelected = TemplateData.TemplateDeviceDataLogic.Current.GetCurtainHandPullControl(deviceCurtain); return; } @@ -1015,7 +1037,7 @@ } #endregion - #region 鈻� 绠�绾﹀鍔熻兘闈㈡澘鐢╛__________________ + #region 鈻� 绠�绾﹀鍔熻兘闈㈡澘鐢╛__________________ /// <summary> /// 娣诲姞銆愮粦瀹氱洰鏍囥�戣 /// </summary> @@ -1030,19 +1052,19 @@ //搴曠嚎 btnBindTargets.AddBottomLine(); btnBindTargets.ButtonClickEvent += (sender, e) => - { - var dev = Common.LocalDevice.Current.GetDevice(deviceMac, 32);//绠�绾﹂潰鏉块殢渚夸竴涓寜閿潵鑾峰彇璁惧 - if (dev != null) - { - var curControlDev = dev as Panel; - var simpleMutilfunctionTargetsPage = new Shared.Phone.UserCenter.DeviceBind.PanelSimpleMutilfunctionTargetsForm(curControlDev); - Shared.Phone.UserView.HomePage.Instance.AddChidren(simpleMutilfunctionTargetsPage); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - simpleMutilfunctionTargetsPage.Show(); + { + var dev = Common.LocalDevice.Current.GetDevice(deviceMac, 32);//绠�绾﹂潰鏉块殢渚夸竴涓寜閿潵鑾峰彇璁惧 + if (dev != null) + { + var curControlDev = dev as Panel; + var simpleMutilfunctionTargetsPage = new Shared.Phone.UserCenter.DeviceBind.PanelSimpleMutilfunctionTargetsForm(curControlDev); + Shared.Phone.UserView.HomePage.Instance.AddChidren(simpleMutilfunctionTargetsPage); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + simpleMutilfunctionTargetsPage.Show(); } }; - } - + } + #region 鈻� 鎺ヨ繎鎰熷簲___________________________ /// <summary> @@ -1062,27 +1084,27 @@ //搴曠嚎 proximitySensors.AddBottomLine(); - btnSwitch.ButtonClickEvent +=async (sender, e) => - { - btnSwitch.IsSelected = !btnSwitch.IsSelected; - proximitySensorsInfo.enable = btnSwitch.IsSelected; - - //绠�绾﹂潰鏉块殢渚夸竴涓洖璺潵鑾峰彇璁惧淇℃伅 - var dev = Common.LocalDevice.Current.GetDevice(deviceMac, 62); - if (dev != null) - { - var key = new ZigBee.Device.Panel(); - key.DeviceAddr = deviceMac; - key.CurrentGateWayId = dev.CurrentGateWayId; - SetProximitySensor(key); - } - }; + btnSwitch.ButtonClickEvent += async (sender, e) => + { + btnSwitch.IsSelected = !btnSwitch.IsSelected; + proximitySensorsInfo.enable = btnSwitch.IsSelected; + + //绠�绾﹂潰鏉块殢渚夸竴涓洖璺潵鑾峰彇璁惧淇℃伅 + var dev = Common.LocalDevice.Current.GetDevice(deviceMac, 62); + if (dev != null) + { + var key = new ZigBee.Device.Panel(); + key.DeviceAddr = deviceMac; + key.CurrentGateWayId = dev.CurrentGateWayId; + SetProximitySensor(key); + } + }; if (proximitySensorsInfo.enable == true) { btnSwitch.IsSelected = true; } } - #endregion + #endregion #region 鈻� 鏁版嵁鐭_________________________ /// <summary> @@ -1240,17 +1262,17 @@ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime) + "(" + "5007_2" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); }); return; - } - - //2銆佽幏璁惧鎺ヨ繎鎰熷簲鍒濆鏁版嵁 - //鎺ヨ繎鎰熷簲(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡) + } + + //2銆佽幏璁惧鎺ヨ繎鎰熷簲鍒濆鏁版嵁 + //鎺ヨ繎鎰熷簲(浠栦滑璇撮殢渚挎嬁涓�璺洖璺氨琛屼簡) proximitySensorsInfo = await HdlDevicePanelLogic.Current.GetDeviceProximitySensorsSettion(curControlDev); if (proximitySensorsInfo == null) { proximitySensorsInfo = new Panel.PanelProximitySensorInfo(); //鍏抽棴杩涘害鏉� this.CloseProgressBar(ShowReLoadMode.YES); - return ; + return; } } catch (Exception ex) @@ -1336,10 +1358,10 @@ result = true; } return result; - } - + } + #region 鈻� 璁剧疆鏁版嵁___________________________ - + /// <summary> /// 璁剧疆闈㈡澘鎺ヨ繎鎰熷簲鏁版嵁 /// </summary> @@ -1356,10 +1378,11 @@ //鎺ヨ繎鎰熷簲(鎻愪緵璁惧鐨勫悓浜嬭闅忎究涓�涓洖璺氨琛�) var result = await HdlDevicePanelLogic.Current.SetProximitySensorStatus(curControlDev, proximitySensorsInfo.enable); if (result == false) - { + { return; } - } catch (Exception ex) + } + catch (Exception ex) { var mess = ex.Message; } @@ -1371,13 +1394,13 @@ }); } }); - } - + } + #endregion #endregion - + #region 鈻� 鍔熻兘绫诲瀷(绌烘皵寮�鍏充笓鐢�)_____________ - + /// <summary> /// 娣诲姞銆愬姛鑳界被鍨嬨�戣(绌烘皵寮�鍏充笓鐢�) /// </summary> @@ -1400,6 +1423,11 @@ rowFunction.InitControl(); //搴曠嚎 rowFunction.AddBottomLine(); + //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈� + if (Common.Config.Instance.Home.IsShowTemplate == true) + { + rowFunction.CanClick = false; + } } #endregion @@ -1446,7 +1474,11 @@ listview.AddChidren(rowVersion); rowVersion.AddLeftCaption(caption, 600); //鐗堟湰 - this.btnAirConditionerVersion = rowVersion.AddMostRightView("", 800); + this.btnAirConditionerVersion = rowVersion.AddMostRightView(string.Empty, 900); + if (this.listNewDevice[0] is AC) + { + this.btnAirConditionerVersion.Text = ((AC)this.listNewDevice[0]).AcModelVersion; + } //搴曠嚎 rowVersion.AddBottomLine(); @@ -1506,7 +1538,8 @@ }; //濡傛灉褰撳墠浣忓畢涓嶆槸铏氭嫙浣忓畢 - if (Common.Config.Instance.Home.IsVirtually == false) + if (Config.Instance.Home.IsVirtually == false + && Config.Instance.Home.IsShowTemplate == false) { //璁剧疆璁惧鐨勭増鏈俊鎭� this.SetDeviceVersionInfo(btnNewVersion, oTADevice); @@ -1524,10 +1557,22 @@ { bool receiveImageInfo = false; //璁剧疆璁惧鍏ㄩ儴鐨勯暅鍍忎俊鎭� - HdlDeviceImageInfoLogic.Current.SetAllImageInfoToOtaDevice(oTADevice, (device, reportData) => + string checkKey = LocalDevice.Current.GetDeviceMainKeys(oTADevice.DeviceAddr, oTADevice.DeviceEpoint); + HdlGatewayReceiveLogic.Current.AddAttributeEvent("SetDeviceVersionInfo", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) => { - receiveImageInfo = true; + if (report.DeviceStatusReport.CluterID == (int)Cluster_ID.Ota) + { + string mainKey = LocalDevice.Current.GetDeviceMainKeys(report.DeviceAddr, report.DeviceEpoint); + if (checkKey == mainKey) + { + //宸茬粡鎺ユ敹寰楀埌 + receiveImageInfo = true; + } + } }); + //鍙戦�佸懡浠� + HdlDeviceImageInfoLogic.Current.SetFirmwareVersionComand(oTADevice); + int count = 5; while (receiveImageInfo == false && count > 0) { @@ -1536,14 +1581,14 @@ count--; } //绉婚櫎浜嬩欢 - HdlDeviceImageInfoLogic.Current.RemoveDeviceFirmwareVersionThread(oTADevice); + HdlGatewayReceiveLogic.Current.RemoveEvent("SetDeviceVersionInfo"); oTADevice = Common.LocalDevice.Current.GetOTADevice(listNewDevice[0].DeviceAddr); //娣诲姞鍗囩骇鍥轰欢淇℃伅(鎴愪笉鎴愬姛閮芥棤鎵�璋�) - var result = HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, oTADevice.HwVersion.ToString(), oTADevice.ImgTypeId.ToString()); + var result = HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.A璁惧, oTADevice.HwVersion.ToString(), oTADevice.ImgTypeId.ToString()); //鑾峰彇璁惧鏈�鏂扮増鏈� - var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice, + var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.A璁惧, oTADevice.HwVersion.ToString(), oTADevice.ImgTypeId.ToString(), oTADevice.ImgVersion); @@ -1600,6 +1645,11 @@ /// </summary> private void InitTopRightMenu() { + //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈� + if (Common.Config.Instance.Home.IsShowTemplate == true) + { + return; + } var btnIcon = new MostRightIconControl(69, 69); btnIcon.UnSelectedImagePath = "Item/More.png"; topFrameLayout.AddChidren(btnIcon); @@ -1735,8 +1785,7 @@ public override void CloseFormBefore() { HdlGatewayReceiveLogic.Current.RemoveEvent("HandPullControl"); - //绉婚櫎鑾峰彇璁惧纭欢淇℃伅鐨勭洃鍚嚎绋� - HdlDeviceHardInfoLogic.Current.RemoveDeviceHardInfoThread(listNewDevice[0]); + HdlGatewayReceiveLogic.Current.RemoveEvent("SetDeviceVersionInfo"); //璁惧鏂板叆缃� if (UserCenterResourse.DicActionForm.ContainsKey("AddDeviceTypeListForm") == true) @@ -1756,21 +1805,13 @@ /// </summary> private void RefreshHardFirmwareInfo() { - if (listNewDevice[0].DriveCode > 0) + if (listNewDevice[0].DriveCode > 0 || Common.Config.Instance.Home.IsShowTemplate == true) { //铏氭嫙璁惧娌℃湁杩欑鎿嶄綔 return; } //閲嶆柊鑾峰彇纭欢淇℃伅 - HdlDeviceHardInfoLogic.Current.SetAllHardFirmwareInfoToDevice(listNewDevice[0], (device, reportData) => - { - for (int i = 1; i < listNewDevice.Count; i++) - { - //鍏ㄩ儴鍥炶矾鐨勪俊鎭兘鏄竴鑷寸殑 - HdlDeviceHardInfoLogic.Current.SetHardFirmwareInfo(device.DeviceStatusReport, listNewDevice[i]); - listNewDevice[i].ReSave(); - } - }); + HdlDeviceHardInfoLogic.Current.SetAllHardFirmwareInfoToDevice(listNewDevice[0]); } #endregion @@ -1801,27 +1842,48 @@ { return; } - //鑾峰彇涓�.... - this.btnAirConditionerVersion.TextID = R.MyInternationalizationString.uGetting; + //濡傛灉鏄櫄鎷熶綇瀹呮垨鑰呭睍绀烘ā鏉跨殑璇� + if (Config.Instance.Home.IsShowTemplate == true || Config.Instance.Home.IsVirtually == true) + { + return; + } + + bool notVersion = true; + if (this.listNewDevice[0] is AC) + { + notVersion = ((AC)this.listNewDevice[0]).AcModelVersion == string.Empty; + } + if (notVersion == true) + { + //鑾峰彇涓� + btnAirConditionerVersion.Text = Language.StringByID(R.MyInternationalizationString.uGetting); + } HdlThreadLogic.Current.RunThread(async () => { //璇诲彇绌鸿皟妯″潡鐗堟湰 var result = await HdlDeviceAirConditionerLogic.Current.ReadACFirewareVersionAsync(listNewDevice[0]); if (result == null || result.readACFirewareVersionResponData == null || result.readACFirewareVersionResponData.Status != 0) { - HdlThreadLogic.Current.RunMain(() => + if (notVersion == true) { //鑾峰彇澶辫触 - btnAirConditionerVersion.TextID = R.MyInternationalizationString.uGettingFail; - }); + HdlThreadLogic.Current.RunMain(() => + { + btnAirConditionerVersion.Text = Language.StringByID(R.MyInternationalizationString.uGettingFail); + }); + } + return; } - else + HdlThreadLogic.Current.RunMain(() => { - HdlThreadLogic.Current.RunMain(() => + string strVersion = result.readACFirewareVersionResponData.FirewareVersion.Replace("-", string.Empty); + if (this.listNewDevice[0] is AC) { - btnAirConditionerVersion.Text = result.readACFirewareVersionResponData.FirewareVersion.Replace("-", string.Empty); - }); - } + ((AC)this.listNewDevice[0]).AcModelVersion = strVersion; + this.listNewDevice[0].ReSave(); + } + btnAirConditionerVersion.Text = strVersion; + }); }); } -- Gitblit v1.8.0