From 31497bb69602433d94c8a28ea01c3ee3c7cc8576 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 24 十月 2019 14:32:30 +0800 Subject: [PATCH] 完全合并了Wjc,Xm 的 代码 --- ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs | 112 ++++++++++---------------------------------------------- 1 files changed, 20 insertions(+), 92 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs index 7662561..8a6a8e7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs @@ -142,15 +142,16 @@ { gatewayRow.frameTable.AddBottomLine(); } - //鎻愮ず鏈夋柊鐗堟湰 - var btnNew = new RowNewVersionTipView(); + //鎻愮ず鏂扮増鏈� + var btnNew = new InformationTipView(gatewayRow.btnIcon); btnNew.Visible = false; gatewayRow.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEventOnly); gatewayRow.AddTag("btnNew", btnNew); //鍗曞嚮浜嬩欢 gatewayRow.frameTable.ButtonClickEvent += (sender, e) => { - + var form = new GatewayInfoEditorForm(); + form.AddForm(gateway); }; //鍒囨崲 @@ -177,7 +178,7 @@ this.ShowMassage(ShowMsgType.Confirm, msg, () => { //鎵ц鍒囨崲缃戝叧鎿嶄綔 - this.DoSwitchGateway(strWayId, gatewayRow.IsOnline); + this.DoSwitchGateway(strWayId); }); }; @@ -219,9 +220,9 @@ this.dicRowContr[strWayId] = gatewayRow; //璁剧疆涓�涓�夋嫨缃戝叧鐨勯粯璁ゅ�� - if (string.IsNullOrEmpty(GatewayResourse.AppOldSelectGatewayId) == true && gatewayRow.IsOnline == true) + if (string.IsNullOrEmpty(GatewayResourse.AppOldSelectGatewayId) == true) { - this.SaveGatewayIdToLocation(strWayId); + HdlGatewayLogic.Current.SaveGatewayIdToLocation(strWayId); } } @@ -247,7 +248,7 @@ { //濡傛灉瑙i櫎缁戝畾鐨勭綉鍏虫槸褰撳墠鎵�閫夋嫨鐨勭綉鍏崇殑璇濓紝鍒欏叧闂澶囩鐞嗙晫闈� this.closeDeviceManagForm = true; - this.SaveGatewayIdToLocation(string.Empty); + HdlGatewayLogic.Current.SaveGatewayIdToLocation(string.Empty); } //绉婚櫎 @@ -267,19 +268,13 @@ /// </summary> /// <param name="gatewayId"></param> /// <param name="online"></param> - private async void DoSwitchGateway(string gatewayId,bool online) + private async void DoSwitchGateway(string gatewayId) { - if (online == true) + var result = await HdlGatewayLogic.Current.DoSwitchGateway(gatewayId); + if (result == false) { - //閲嶆柊鑾峰彇鍦ㄧ嚎缃戝叧鐨勪俊鎭� - var result = await this.GetOnlineGatewayInfo(gatewayId); - if (result == false) - { - return; - } + return; } - //鍒囨崲缃戝叧,淇濆瓨缂撳瓨 - this.SaveGatewayIdToLocation(gatewayId); //濡傛灉閫夋嫨浜嗗埛鏂扮殑缃戝叧锛屽垯涓嶅叧闂鐞嗙晫闈� this.closeDeviceManagForm = false; @@ -296,79 +291,6 @@ //鍒锋柊涓荤敾闈�(涓嶉噸鏂拌幏鍙栬澶囩姸鎬�) this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame", false); } - } - - /// <summary> - /// 鑾峰彇鍦ㄧ嚎缃戝叧淇℃伅 - /// </summary> - /// <param name="gatewayId"></param> - /// <returns></returns> - private async Task<bool> GetOnlineGatewayInfo(string gatewayId) - { - //鏄剧ず杩涘害鏉� - this.ShowProgressBar(); - //鑾峰彇缃戝叧 - var gateway = HdlGatewayLogic.Current.GetLocalGateway(gatewayId); - - //妫�娴嬪箍鎾埌鐨勮繖涓綉鍏虫槸鍚︽嫢鏈変綇瀹匢D - ZbGateway realWay = null; - bool getGatewayInfo = true; - if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, gatewayId) == true) - { - //閲嶆柊璁剧疆浣忓畢ID(杩欎釜搴旇鏄笉缁忚繃APP,鐩存帴鎶婄綉鍏虫仮澶嶄簡鍑哄巶璁剧疆) - if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true) - { - int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay); - if (result2 == 0) - { - //鍑虹幇鏈煡閿欒,璇风◢鍚庡啀璇� - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain)); - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - } - else if (result2 == -1) - { - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - return false; - } - //閲嶆柊缁戝畾缃戝叧閲岄潰宸茬粡閲嶆柊鑾峰彇浜嗙綉鍏充俊鎭� - getGatewayInfo = false; - } - } - - if (getGatewayInfo == true) - { - //鑾峰彇缃戝叧淇℃伅 - var info = await HdlGatewayLogic.Current.GetGatewayNewInfoAsync(gateway); - if (info == null) - { - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - return false; - } - } - - //鑾峰彇鍏ㄩ儴璁惧 - bool result = await Common.LocalDevice.Current.SetDeviceToMemmoryByGateway(gateway); - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - if (result == false) - { - return false; - } - return true; - } - - /// <summary> - /// 淇濆瓨閫夋嫨鐨勭綉鍏矷D鍒版湰鍦� - /// </summary> - /// <param name="gatewayId"></param> - private void SaveGatewayIdToLocation(string gatewayId) - { - GatewayResourse.AppOldSelectGatewayId = gatewayId; - byte[] data = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(GatewayResourse.AppOldSelectGatewayId)); - Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AppOldSelectGatewayFile, data); } #endregion @@ -472,7 +394,7 @@ { if (this.dicRowContr.ContainsKey(gwid) == true && this.dicRowContr[gwid] != null) { - var btnNew = (RowNewVersionTipView)this.dicRowContr[gwid].GetTagByKey("btnNew"); + var btnNew = (InformationTipView)this.dicRowContr[gwid].GetTagByKey("btnNew"); if (btnNew != null) { btnNew.Visible = true; @@ -494,7 +416,7 @@ { base.CloseForm(); - if (string.IsNullOrEmpty(GatewayResourse.AppOldSelectGatewayId) == true && this.closeDeviceManagForm == true) + if (this.closeDeviceManagForm == true) { //鍏抽棴鐣岄潰 HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId(); @@ -511,6 +433,12 @@ /// </summary> public override int FormActionAgainEvent() { + //杩涘埌杩欎釜鐣岄潰,鐞嗚涓婂墠鍥炵殑缃戝叧id鏄湁鐨�,濡傛灉涓虹┖浜�,搴旇鏄綋鍓嶇殑缃戝叧琚В缁戜簡 + if (GatewayResourse.AppOldSelectGatewayId == string.Empty) + { + //鍏抽棴璁惧鍒楄〃 + this.closeDeviceManagForm = true; + } //鍒濆鍖栦腑閮ㄦ帶浠� this.InitMiddleFrame(); return 1; -- Gitblit v1.8.0