From 0087dd7734e71dfcfd1bb54db394ad7855021ffd Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期五, 24 七月 2020 10:18:08 +0800 Subject: [PATCH] 新版本 --- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 83 ++++++++++++++++++++++++++++++++++------- 1 files changed, 69 insertions(+), 14 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs index 721ae90..5f24bcd 100755 --- 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); + } } } @@ -1073,7 +1076,7 @@ paneTargetsBaseFormp.Show(); paneTargetsBaseFormp.actionHumidityTarget += (bindName) => { - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { if (string.IsNullOrEmpty(bindName)) { @@ -1124,7 +1127,7 @@ paneTargetsBaseFormp.Show(); paneTargetsBaseFormp.actionTemperatureTarget += (bindName) => { - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { if (string.IsNullOrEmpty(bindName)) { @@ -1159,7 +1162,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 +1174,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 +1210,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; @@ -1400,7 +1407,7 @@ /// <param name="oTADevice">ota璁惧</param> private void SetDeviceVersionInfo(PicViewControl btnNewVersion, OTADevice oTADevice) { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { bool receiveImageInfo = false; //璁剧疆璁惧鍏ㄩ儴鐨勯暅鍍忎俊鎭� @@ -1412,7 +1419,7 @@ while (receiveImageInfo == false && count > 0) { //绛夊緟璁惧闀滃儚鐨勫弽棣� - await Task.Delay(300); + System.Threading.Thread.Sleep(300); count--; } //绉婚櫎浜嬩欢 @@ -1420,7 +1427,7 @@ oTADevice = Common.LocalDevice.Current.GetOTADevice(listNewDevice[0].DeviceAddr); //娣诲姞鍗囩骇鍥轰欢淇℃伅(鎴愪笉鎴愬姛閮芥棤鎵�璋�) - var result = await HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, oTADevice.HwVersion.ToString(), oTADevice.ImgTypeId.ToString()); + var result = HdlFirmwareUpdateLogic.AddFirmwareVersionInfo(FirmwareLevelType.ZigbeeDevice, oTADevice.HwVersion.ToString(), oTADevice.ImgTypeId.ToString()); //鑾峰彇璁惧鏈�鏂扮増鏈� var deviceFirmware = HdlFirmwareUpdateLogic.GetFirmwareMostVersionInfo(FirmwareLevelType.ZigbeeDevice, @@ -1430,13 +1437,13 @@ if (deviceFirmware != null && deviceFirmware.FirmwareVersion > oTADevice.ImgVersion) { - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { if (btnNewVersion != null) { btnNewVersion.Visible = true; } - }); + }, ShowErrorMode.NO); } }); } @@ -1499,7 +1506,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 +1547,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 +1591,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