From ed2f4a97aa48cdb4a013d2a389877f52eb3eccdf Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期二, 29 十月 2019 13:15:59 +0800 Subject: [PATCH] Merge branch 'DEV_GXC' of http://172.16.1.23:6688/r/~xm/HomeApp into DEV_GXC --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs | 149 ++++++++++++++++++------------------------------- 1 files changed, 55 insertions(+), 94 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs index 20c6cb8..c62be4d 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayLogic.cs @@ -391,7 +391,7 @@ /// 閲嶆柊缁戝畾缃戝叧(1:姝e父 -1:寮傚父 0:褰撳墠鐨勭綉鍏崇粦瀹氬湪浜嗗綋鍓嶈处鍙蜂笅鐨勪笉鍚屼綇瀹呴噷闈�) /// </summary> /// <param name="zbGateway">缃戝叧</param> - public async Task<int> ReBindNewGateway(ZbGateway zbGateway, NormalViewControl btnMsg = null) + public async Task<int> ReBindNewGateway(ZbGateway zbGateway) { if (zbGateway == null) { @@ -424,19 +424,9 @@ HdlGatewayLogic.Current.BackupGatewayIdOnNotNetwork(zbGateway); } - if (btnMsg == null) - { - //缃戝叧鍐呴儴鏁版嵁鍙樻洿涓�,璇风◢鍚� - ProgressBar.SetValue(Language.StringByID(R.MyInternationalizationString.uGatewayDataIsChangingPleaseWhait)); - } - else - { - HdlThreadLogic.Current.RunMain(() => - { - //缃戝叧鍐呴儴鏁版嵁鍙樻洿涓�,璇风◢鍚� - btnMsg.TextID = R.MyInternationalizationString.uGatewayDataIsChangingPleaseWhait; - }); - } + //缃戝叧鍐呴儴鏁版嵁鍙樻洿涓�,璇风◢鍚� + ProgressBar.SetValue(Language.StringByID(R.MyInternationalizationString.uGatewayDataIsChangingPleaseWhait)); + await System.Threading.Tasks.Task.Delay(8000); //鑾峰彇缃戝叧鐨勪俊鎭� @@ -1063,60 +1053,38 @@ } /// <summary> - /// 璁剧疆缃戝叧闀滃儚绫诲瀷鐨勭炕璇戝悕瀛� + /// 鑾峰彇缃戝叧闀滃儚绫诲瀷鐨勭炕璇戝悕瀛� /// </summary> - /// <param name="button"></param> /// <param name="zbGateway"></param> /// <returns></returns> - public void SetGatewayImageText(Button button, ZbGateway zbGateway) + public string GetGatewayImageText(ZbGateway zbGateway) { - //鍒濆鍊�:鏃犳硶璇嗗埆鐨勭綉鍏宠澶� - button.TextID = R.MyInternationalizationString.uUnDistinguishTheGatewayDevice; - string gwId = this.GetGatewayId(zbGateway); + int imageType = -1; if (this.dicGateway.ContainsKey(gwId) == false || this.dicGateway[gwId].getGwInfo == null) { //濡傛灉杩欎釜缃戝叧娌℃湁淇℃伅锛屽垯浠庢柊鑾峰彇 - if (zbGateway.getGwInfo != null && zbGateway.getGwInfo.LinuxImageType != 0) + var result = this.GetGatewayNewInfo(zbGateway, ShowErrorMode.NO); + if (result == null) { - string keyName = Common.LocalDevice.deviceModelIdName + zbGateway.getGwInfo.LinuxImageType; - if (Common.LocalDevice.Current.dicDeviceDefultNameID.ContainsKey(keyName) == true) - { - //浣跨敤R鏂囦欢閲岄潰璁剧疆鐨勪笢瑗� - button.TextID = LocalDevice.Current.dicDeviceDefultNameID[keyName]; - } + //鏃犳硶璇嗗埆鐨勭綉鍏宠澶� + return Language.StringByID(R.MyInternationalizationString.uUnDistinguishTheGatewayDevice); } - else - { - //缁欎竴涓嚎绋嬪幓鑾峰彇瀹冪殑闀滃儚绫诲瀷 - HdlThreadLogic.Current.RunThread(async () => - { - var result = await this.GetGatewayNewInfoAsync(zbGateway, ShowErrorMode.NO); - if (result != null) - { - zbGateway.getGwInfo = result; - HdlThreadLogic.Current.RunMain(() => - { - string keyName = Common.LocalDevice.deviceModelIdName + zbGateway.getGwInfo.LinuxImageType; - if (Common.LocalDevice.Current.dicDeviceDefultNameID.ContainsKey(keyName) == true) - { - //浣跨敤R鏂囦欢閲岄潰璁剧疆鐨勪笢瑗� - button.TextID = LocalDevice.Current.dicDeviceDefultNameID[keyName]; - } - }); - } - }); - } + imageType = result.LinuxImageType; } else { - string keyName = Common.LocalDevice.deviceModelIdName + this.dicGateway[gwId].getGwInfo.LinuxImageType; - if (Common.LocalDevice.Current.dicDeviceDefultNameID.ContainsKey(keyName) == true) - { - //浣跨敤R鏂囦欢閲岄潰璁剧疆鐨勪笢瑗� - button.TextID = Common.LocalDevice.Current.dicDeviceDefultNameID[keyName]; - } + imageType = Convert.ToInt32(this.GetGwInfoAttribute(this.dicGateway[gwId], "LinuxImageType")); } + string keyName = Common.LocalDevice.deviceModelIdName + imageType; + if (Common.LocalDevice.Current.dicDeviceDefultNameID.ContainsKey(keyName) == true) + { + //浣跨敤R鏂囦欢閲岄潰璁剧疆鐨勪笢瑗� + return Language.StringByID(Common.LocalDevice.Current.dicDeviceDefultNameID[keyName]); + } + + //鏃犳硶璇嗗埆鐨勭綉鍏宠澶� + return Language.StringByID(R.MyInternationalizationString.uUnDistinguishTheGatewayDevice); } #endregion @@ -1346,7 +1314,7 @@ #region 鈻� 涓荤綉鍏冲垽瀹歘________________________ /// <summary> - /// 鍒ゆ柇鏄惁涓荤綉鍏�(1:涓荤綉鍏� 0:涓嶅湪绾� 2:瀛愮綉鍏�) + /// 鍒ゆ柇鏄惁涓荤綉鍏�(1:涓荤綉鍏� 0:涓嶅湪绾� -1:杩滅▼妯″紡,涓嶅瓨鍦ㄥ暐涓荤綉鍏崇殑璇存硶) /// </summary> /// <param name="zbGateway">缃戝叧瀵硅薄</param> /// <returns></returns> @@ -1357,7 +1325,7 @@ } /// <summary> - /// 鍒ゆ柇鏄惁涓荤綉鍏�(1:涓荤綉鍏� 0:涓嶅湪绾� 2:瀛愮綉鍏�) + /// 鍒ゆ柇鏄惁涓荤綉鍏�(1:涓荤綉鍏� 0:涓嶅湪绾� -1:杩滅▼妯″紡,涓嶅瓨鍦ㄥ暐涓荤綉鍏崇殑璇存硶) /// </summary> /// <param name="waiID">缃戝叧id</param> /// <returns></returns> @@ -1368,7 +1336,7 @@ { return 0; } - return zbGateway.IsMainGateWay == true ? 1 : 2; + return zbGateway.IsMainGateWay == true ? 1 : 0; } #endregion @@ -1376,7 +1344,7 @@ #region 鈻� 璁剧疆缃戝叧鍥剧墖_______________________ /// <summary> - /// 璁剧疆鐪熷疄缃戝叧鐨勫浘鐗� + /// 璁剧疆鐪熷疄缃戝叧鐨勫浘鐗囷紝瑙勬牸锛�915X492 /// </summary> /// <param name="button"></param> /// <param name="zbGateway"></param> @@ -1386,35 +1354,30 @@ var localWay = this.GetLocalGateway(gwID); if (localWay == null || localWay.getGwInfo == null) { - if (zbGateway.getGwInfo != null && zbGateway.getGwInfo.LinuxImageType != 0) + //缁欎竴涓嚎绋嬪幓鑾峰彇瀹冪殑闀滃儚绫诲瀷 + HdlThreadLogic.Current.RunThread(async () => { - button.UnSelectedImagePath = "Gateway/RealGateway" + zbGateway.getGwInfo.LinuxImageType + ".png"; - } - else - { - //缁欎竴涓嚎绋嬪幓鑾峰彇瀹冪殑闀滃儚绫诲瀷 - HdlThreadLogic.Current.RunThread(async () => + var result = await this.GetGatewayNewInfoAsync(zbGateway, ShowErrorMode.NO); + if (result != null) { - var result = await this.GetGatewayNewInfoAsync(zbGateway, ShowErrorMode.NO); - if (result != null) + Application.RunOnMainThread(() => { - zbGateway.getGwInfo = result; - HdlThreadLogic.Current.RunMain(() => + if (button != null) { button.UnSelectedImagePath = "Gateway/RealGateway" + result.LinuxImageType + ".png"; - }); - } - }); - } + } + }); + } + }); } else { - button.UnSelectedImagePath = "Gateway/RealGateway" + localWay.getGwInfo.LinuxImageType + ".png"; + button.UnSelectedImagePath = "Gateway/RealGateway" + this.GetGwInfoAttribute(localWay, "LinuxImageType").ToString() + ".png"; } } /// <summary> - /// 璁剧疆缃戝叧鍥炬爣 + /// 璁剧疆缃戝叧鍥炬爣锛岃鏍硷細110X110 /// </summary> /// <param name="button"></param> /// <param name="zbGateway"></param> @@ -1424,30 +1387,28 @@ var localWay = this.GetLocalGateway(gwID); if (localWay == null || localWay.getGwInfo == null) { - if (zbGateway.getGwInfo != null && zbGateway.getGwInfo.LinuxImageType != 0) + //缁欎竴涓嚎绋嬪幓鑾峰彇瀹冪殑闀滃儚绫诲瀷 + HdlThreadLogic.Current.RunThread(async () => { - button.UnSelectedImagePath = "Gateway/GatewayIcon" + zbGateway.getGwInfo.LinuxImageType + ".png"; - } - else - { - //缁欎竴涓嚎绋嬪幓鑾峰彇瀹冪殑闀滃儚绫诲瀷 - HdlThreadLogic.Current.RunThread(async () => + var result = await this.GetGatewayNewInfoAsync(zbGateway, ShowErrorMode.NO); + if (result != null) { - var result = await this.GetGatewayNewInfoAsync(zbGateway, ShowErrorMode.NO); - if (result != null) + Application.RunOnMainThread(() => { - zbGateway.getGwInfo = result; - HdlThreadLogic.Current.RunMain(() => + if (button != null) { button.UnSelectedImagePath = "Gateway/GatewayIcon" + result.LinuxImageType + ".png"; - }); - } - }); - } + button.SelectedImagePath = "Gateway/GatewayIcon" + result.LinuxImageType + "Selected.png"; + } + }); + } + }); } else { - button.UnSelectedImagePath = "Gateway/GatewayIcon" + localWay.getGwInfo.LinuxImageType + ".png"; + string linType = this.GetGwInfoAttribute(localWay, "LinuxImageType").ToString(); + button.UnSelectedImagePath = "Gateway/GatewayIcon" + linType + ".png"; + button.SelectedImagePath = "Gateway/GatewayIcon" + linType + "Selected.png"; } } @@ -1482,13 +1443,13 @@ #endregion - #region 鈻� 缃戝叧瀹氫綅___________________________ + #region 鈻� 娴嬭瘯缃戝叧___________________________ /// <summary> - /// 鍙戦�佹寚浠ゅ埌缃戝叧杩涜瀹氫綅(缃戝叧LED闂儊璇嗗埆) + /// 鍙戦�佹祴璇曟寚浠ゅ埌璁惧(缃戝叧LED闂儊璇嗗埆) /// </summary> /// <param name="zbGateway"></param> - public void SetFixedPositionCommand(ZbGateway zbGateway) + public void SetTestCommand(ZbGateway zbGateway) { ZbGateway realWay = null; if (this.GetRealGateway(ref realWay, zbGateway) == false) -- Gitblit v1.8.0