From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs | 130 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 124 insertions(+), 6 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs b/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs old mode 100755 new mode 100644 index d15dba7..ae83791 --- a/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs +++ b/ZigbeeApp/Shared/Phone/MainPage/HomeMainPageForm.cs @@ -84,6 +84,8 @@ this.AddSensorDeviceReportEvent(); //寮�鍚紶鎰熷櫒鐘舵�佽繕鍘熺殑绾跨▼ this.StartRecoverSenorStatuThread(); + //鏄剧ずApp鍏憡 + this.ShowAppNotice(); } /// <summary> @@ -648,7 +650,17 @@ //娓╂箍搴� else if (device.Type == DeviceType.TemperatureSensor) { - cardContr = new Controls.DeviceTemperatureCardControl(); + //绌烘皵璐ㄩ噺浼犳劅鍣� + //鑾峰彇璁惧绫诲瀷 + var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); + if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) + { + cardContr = new Controls.DeviceAirQualitySensorCardControl(); + } + else + { + cardContr = new Controls.DeviceTemperatureCardControl(); + } } //闂ㄩ攣 else if (device.Type == DeviceType.DoorLock) @@ -661,7 +673,7 @@ cardContr = new Controls.DeviceColorTemperatureCardControl(); } //鏃犳硶璇嗗埆 - else + if (cardContr == null) { cardContr = new Controls.DeviceCardCommon(); } @@ -1129,10 +1141,13 @@ //鏅捐。鏋朵笂鎶ラ渶瑕佺壒娈婂鐞嗭紝鍏朵粬涓婃姤鐨勫洖璺粺涓�杞负绔偣1 var tempList = LocalDevice.Current.GetDevicesByMac(report.DeviceAddr); - var tempDeviceEnum = LocalDevice.Current.GetMyDeviceEnumInfo(tempList); - if (tempDeviceEnum.ConcreteType == Common.DeviceConcreteType.Airer) + if (tempList.Count > 0) { - mainKeys = report.DeviceAddr + "_" + 1; + var tempDeviceEnum = LocalDevice.Current.GetMyDeviceEnumInfo(tempList); + if (tempDeviceEnum.ConcreteType == Common.DeviceConcreteType.Airer) + { + mainKeys = report.DeviceAddr + "_" + 1; + } } if (this.dicDeviceCardControl.ContainsKey(mainKeys) == true) @@ -1301,6 +1316,109 @@ return true; } + /// <summary> + /// 鏄剧ずApp鍏憡 + /// </summary> + private void ShowAppNotice() + { + HdlThreadLogic.Current.RunThread(() => + { + if (HdlFirmwareUpdateLogic.CheckCanShowNotice() == true) + { + while (this.IsFormOpen("HdlAutoBackupForm") == true) + { + //鑷姩澶囦唤鐨勭晫闈㈡鍦ㄦ墦寮�涓� + System.Threading.Thread.Sleep(1000); + } + HdlThreadLogic.Current.RunMain(() => + { + //鍔犺浇绯荤粺鍏憡 + var form2 = new AppNoticeForm(); + UserView.UserPage.Instance.AddChidren(form2); + form2.Show(); + form2.FinishEvent += () => + { + HdlThreadLogic.Current.RunThread(() => + { + System.Threading.Thread.Sleep(1000); + //鏄剧ずApp鍗囩骇鐨勫脊绐� + this.ShowUpdateAppDialog(); + + }, ShowErrorMode.NO); + }; + + }, ShowErrorMode.NO); + } + else + { + //鏄剧ずApp鍗囩骇鐨勫脊绐� + this.ShowUpdateAppDialog(); + } + }, ShowErrorMode.NO); + } + + /// <summary> + /// 鏄剧ずApp鍗囩骇鐨勫脊绐� + /// </summary> + private void ShowUpdateAppDialog() + { + //App鍗囩骇鎻愮ず + if (string.IsNullOrEmpty(FirmwareUpdateResourse.AppNeedUpdateUrl) == false) + { + //鏁翠簡涓�娆′箣鍚庡氨涓嶆暣浜� + string updateUrl = FirmwareUpdateResourse.AppNeedUpdateUrl; + FirmwareUpdateResourse.AppNeedUpdateUrl = string.Empty; + + while (this.IsFormOpen("HdlAutoBackupForm") == true) + { + //鑷姩澶囦唤鐨勭晫闈㈡鍦ㄦ墦寮�涓� + System.Threading.Thread.Sleep(1000); + } + //鍙戠幇APP鏂扮増鏈�,椹笂鍗囩骇{0}寮�鍚柊浣撻獙鍝 + this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uAppUpdateMsg1).Replace("{0}", "\r\n"), () => + { +#if iOS + Uri url = new Uri(updateUrl); + UIKit.UIApplication.SharedApplication.OpenUrl(url); +#endif +#if Android + HDLUtils.OpenUrl(updateUrl); +#endif + }, Language.StringByID(R.MyInternationalizationString.uLevelUp)); + //App鍗囩骇鎻愮ず浼樺厛 + return; + } + //缃戝叧鍗囩骇鎻愮ず + if (FirmwareUpdateResourse.ListGatewayNeedUpdate.Count > 0) + { + //鏁村畬涔嬪悗灏辨竻绌� + var listGateway = new List<string>(); + listGateway.AddRange(FirmwareUpdateResourse.ListGatewayNeedUpdate); + FirmwareUpdateResourse.ListGatewayNeedUpdate = new List<string>(); + + while (this.IsFormOpen("HdlAutoBackupForm") == true) + { + //鑷姩澶囦唤鐨勭晫闈㈡鍦ㄦ墦寮�涓� + System.Threading.Thread.Sleep(1000); + } + foreach (var gwId in listGateway) + { + //鐩墠鍙暣涓�涓� + if (HdlGatewayLogic.Current.IsGatewayExist(gwId) == true) + { + //鍙戠幇缃戝叧鏂扮増鏈�,椹笂鍗囩骇{0}寮�鍚柊浣撻獙鍝 + this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uGatewayUpdateMsg1).Replace("{0}", "\r\n"), () => + { + var form = new UserCenter.GatewayUpdate.GatewayFirmwareUpdateForm(); + form.AddForm(HdlGatewayLogic.Current.GetLocalGateway(gwId)); + }); + break; + } + } + return; + } + } + #endregion #region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________ @@ -1314,6 +1432,6 @@ return 1; } - #endregion +#endregion } } -- Gitblit v1.8.0