From a7ab4b610972e20753dfedb3e5d80e4d9f017d07 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期五, 14 八月 2020 10:39:08 +0800 Subject: [PATCH] 临时备份,测试1 --- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 135 ++++++++++++++++++++++++++++++++++++-------- 1 files changed, 110 insertions(+), 25 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs old mode 100755 new mode 100644 index abcd1c3..75ce326 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs @@ -102,10 +102,13 @@ { //绠�绾﹂潰鏉块殢渚夸竴涓洖璺潵鑾峰彇璁惧淇℃伅 var dev = Common.LocalDevice.Current.GetDevice(deviceMac, 62); - var key = new ZigBee.Device.Panel(); - key.DeviceAddr = deviceMac; - key.CurrentGateWayId = dev.CurrentGateWayId; - InitBindInfo(key); + if (dev != null) + { + var key = new ZigBee.Device.Panel(); + key.DeviceAddr = deviceMac; + key.CurrentGateWayId = dev.CurrentGateWayId; + InitBindInfo(key); + } } } @@ -291,6 +294,7 @@ this.AddFunctionSettionRow(); this.AddHumiditySourceRow(deviceMacTemp); this.AddTemperatureSensorRow(deviceMacTemp); + this.DataCorrectionRow(deviceMacTemp); } else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleEnvironment) { @@ -599,7 +603,7 @@ btnFunction.ButtonClickEvent += (sender, e) => { //绠�绾︾幆澧冮潰鏉跨殑鎸夐敭閰嶇疆 - var form = new DevicePanel.PanelSimpleEnvironmentButtonSettionForm(); + var form = new DevicePanel.PanelSettionWithSourceForm(); form.AddForm(listNewDevice[0]); }; } @@ -640,16 +644,10 @@ var form = new DevicePanel.PanelFangyueButtonSettionForm(); form.AddForm(listNewDevice[0]); } - else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment) + else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueEnvironment || deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir) { - //鏂规偊鐜闈㈡澘鐨勬寜閿厤缃� - var form = new DevicePanel.PanelFangyueEnvironmentButtonSettionForm(); - form.AddForm(listNewDevice[0]); - } - else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir) - { - //鏂规偊鏂伴闈㈡澘鐨勬寜閿厤缃� - var form = new DevicePanel.PanelFangyueFreshAirButtonSettionForm(); + //鏂规偊鐜闈㈡澘鐨勬寜閿厤缃�&鏂规偊鏂伴闈㈡澘鐨勬寜閿厤缃� + var form = new DevicePanel.PanelSettionWithSourceForm(); form.AddForm(listNewDevice[0]); } else @@ -1028,13 +1026,48 @@ //搴曠嚎 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(); + } + }; + } + + #region 鈻� 鏁版嵁鐭_________________________ + /// <summary> + /// 鏁版嵁鐭琛� + /// </summary> + private void DataCorrectionRow(string deviceMac) + { + //鏁版嵁鐭 + var rowLight = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(rowLight); + rowLight.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.DataCorrection), 600); + //搴曠嚎 + rowLight.AddBottomLine(); + //鍙崇澶� + rowLight.AddRightArrow(); + rowLight.ButtonClickEvent += (sender, e) => { - var simpleMutilfunctionTargetsPage = new Shared.Phone.UserCenter.DeviceBind.PanelSimpleMutilfunctionTargetsForm(deviceMac); - Shared.Phone.UserView.HomePage.Instance.AddChidren(simpleMutilfunctionTargetsPage); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - simpleMutilfunctionTargetsPage.Show(); + var dev = Common.LocalDevice.Current.GetDevice(deviceMac, 62);//绠�绾﹂潰鏉块殢渚夸竴涓洖璺潵鑾峰彇璁惧 + var device = new CommonDevice(); + if (dev != null) + { + device.CurrentGateWayId = dev.CurrentGateWayId; + } + device.DeviceAddr = deviceMac; + device.DeviceEpoint = 65; + var form = new Shared.Phone.UserCenter.DevicePanel.DataCorrectionForm(); + form.AddForm(device); }; } + #endregion /// <summary> /// 婀垮害鏉ユ簮琛� @@ -1073,7 +1106,7 @@ paneTargetsBaseFormp.Show(); paneTargetsBaseFormp.actionHumidityTarget += (bindName) => { - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { if (string.IsNullOrEmpty(bindName)) { @@ -1124,7 +1157,7 @@ paneTargetsBaseFormp.Show(); paneTargetsBaseFormp.actionTemperatureTarget += (bindName) => { - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { if (string.IsNullOrEmpty(bindName)) { @@ -1159,7 +1192,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_2" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); }); return; } @@ -1171,7 +1204,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_3" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); }); return; } @@ -1207,6 +1240,10 @@ foreach (var bDev in bindList) { var device = Common.LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint); + if (device == null) + { + continue; + } if (device.Type == DeviceType.TemperatureSensor) { var bD = device as TemperatureSensor; @@ -1430,13 +1467,13 @@ if (deviceFirmware != null && deviceFirmware.FirmwareVersion > oTADevice.ImgVersion) { - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { if (btnNewVersion != null) { btnNewVersion.Visible = true; } - }); + }, ShowErrorMode.NO); } }); } @@ -1499,7 +1536,17 @@ //妫�娴嬫鍥炶矾鏄惁鎷ユ湁瀹氫綅鍔熻兘(鎷跨鐐规渶灏忕殑閭d釜鍥炶矾鍘诲畾浣�) bool canTest = Common.LocalDevice.Current.DeviceIsCanFixedPosition(listNewDevice[0]); - var frame = new TopRightMenuControl(canTest == true ? 2 : 1, 1); + TopRightMenuControl frame = null; + + if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction) + { + frame = new TopRightMenuControl(3, 1); + } + else + { + frame = new TopRightMenuControl(canTest == true ? 2 : 1, 1); + } + string deviceMenu = string.Empty; if (canTest == true) { @@ -1530,6 +1577,23 @@ }); }); + //鍚屾 + deviceMenu = Language.StringByID(R.MyInternationalizationString.Synchronization); + if (Common.LocalDevice.Current.DeviceIsCanFixedPosition(listNewDevice[0])) + { + frame.AddRowMenu(deviceMenu, "", "Item/SynchronizationSelected.png", () => + { + //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹�,姝ゅ姛鑳芥棤鏁� + if (Common.Config.Instance.Home.IsVirtually == true) + { + return; + } + + //鍚屾鎸囧畾璁惧 + this.SynchronizationDevice(); + }); + } + } /// <summary> @@ -1557,6 +1621,27 @@ }); }); } + + /// <summary> + /// 鍚屾鎸囧畾璁惧 + /// </summary> + private void SynchronizationDevice() + { + HdlThreadLogic.Current.RunThread(async () => + { + //鎵撳紑杩涘害鏉� + this.ShowProgressBar(); + + //鍚屾璁惧 + bool result = await Common.LocalDevice.Current.SynchronizationDevice(listNewDevice); + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + if (result == false) + { + return; + } + }); + } #endregion #region 鈻� 鍏抽棴鐣岄潰___________________________ -- Gitblit v1.8.0