From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 28 二月 2020 15:25:13 +0800 Subject: [PATCH] 2020.2.28 --- ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs | 148 ++++++++++++++++++------------------------------ 1 files changed, 56 insertions(+), 92 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs index 2a2ea96..58c9eba 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs @@ -87,8 +87,20 @@ /// </summary> private async void SetBackupInfoToForm() { + this.nowSelectBackId = string.Empty; + this.nowbtnSelect = null; + //杩涘害鏉� this.ShowProgressBar(); + + //鑾峰彇鑷姩澶囦唤鐨勬暟鎹� + var pageAuto = await HdlBackupLogic.Current.GetBackupListNameFromDB(3, HdlGatewayLogic.Current.GetGatewayId(realGateway)); + if (pageAuto == null) + { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(ShowReLoadMode.YES); + return; + } //浠庝簯绔幏鍙栨暟鎹� var pageData = await HdlBackupLogic.Current.GetBackupListNameFromDB(2, HdlGatewayLogic.Current.GetGatewayId(realGateway)); @@ -105,14 +117,24 @@ { listView.RemoveAll(); listView.RecoverHeight(); + + //鑷姩澶囦唤鐨処D + string autoID = string.Empty; + if (pageAuto.Count > 0) + { + autoID = pageAuto[0].Id; + //娣诲姞鑷姩澶囦唤琛� + this.AddRowlayout(pageAuto[0], pageData.Count > 0, true); + } + for (int i = 0; i < pageData.Count; i++) { //娣诲姞澶囦唤琛� - this.AddRowlayout(pageData[i], i != pageData.Count - 1); + this.AddRowlayout(pageData[i], i != pageData.Count - 1, false); } this.btnDownload?.RemoveFromParent(); - if (pageData.Count > 0) + if (pageData.Count > 0 || pageAuto.Count > 0) { //涓嬭浇 this.btnDownload = new BottomClickButton(); @@ -128,13 +150,24 @@ string msg = Language.StringByID(R.MyInternationalizationString.uDownLoadAndRecoverMsg); this.ShowMassage(ShowMsgType.Confirm, msg, () => { - this.LoadBackupInfo(this.nowSelectBackId); + HdlThreadLogic.Current.RunThread(() => + { + //璇诲彇澶囦唤鏂囨。 + bool result = HdlGatewayBackupLogic.Current.RecoverGateway(this.realGateway, this.nowSelectBackId, autoID == this.nowSelectBackId ? 1 : 0); + if (result == true) + { + HdlThreadLogic.Current.RunMain(() => + { + //鍏抽棴杩欎釜鐣岄潰 + this.CloseForm(); + }); + } + }); }); }; //璋冩暣鐪熷疄楂樺害 listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(23)); } - }); } @@ -147,7 +180,8 @@ /// </summary> /// <param name="fileInfo"></param> /// <param name="addLine"></param> - private void AddRowlayout(BackupListNameInfo fileInfo, bool addLine) + /// <param name="isAuto"></param> + private void AddRowlayout(BackupListNameInfo fileInfo, bool addLine, bool isAuto) { var rowLayout = new RowLayoutControl(listView.rowSpace / 2); listView.AddChidren(rowLayout); @@ -157,6 +191,11 @@ txtText.TextSize = 15; txtText.Y = Application.GetRealHeight(12) + rowLayout.chidrenYaxis; rowLayout.frameTable.AddChidren(txtText, ChidrenBindMode.BindEventOnly); + if (isAuto == true) + { + txtText.TextID = R.MyInternationalizationString.uAutoBackup; + } + //鏃堕棿 2019-11-11T11:31:01 var btnTime = rowLayout.frameTable.AddLeftCaption("", 600, 50, true); btnTime.Y = Application.GetRealHeight(72) + rowLayout.chidrenYaxis; @@ -196,13 +235,17 @@ } }; - //缂栬緫 - var btnEditor = rowLayout.AddEditorControl(); - btnEditor.ButtonClickEvent += (sender, e) => + //鑷姩澶囦唤涓嶅厑璁哥紪杈� + if (isAuto == false) { - //鏄剧ず缂栬緫澶囪�冨悕鐢婚潰 - this.ShowEditorBackupForm(fileInfo); - }; + //缂栬緫 + var btnEditor = rowLayout.AddEditorControl(); + btnEditor.ButtonClickEvent += (sender, e) => + { + //鏄剧ず缂栬緫澶囪�冨悕鐢婚潰 + this.ShowEditorBackupForm(fileInfo); + }; + } //鍒犻櫎 var btnDelete = rowLayout.AddDeleteControl(); @@ -216,46 +259,6 @@ this.DeleteBackInfo(fileInfo.Id); }); }; - } - - #endregion - - #region 鈻� 璇诲彇澶囦唤鏂囨。_______________________ - - /// <summary> - /// 璇诲彇澶囦唤鏂囨。 - /// </summary> - /// <param name="BackupClassId"></param> - private void LoadBackupInfo(string BackupClassId) - { - HdlThreadLogic.Current.RunThread(async () => - { - //鑾峰彇缃戝叧涓婇潰瀛樺湪鐨勫叏閮ㄦ枃浠� - var listFile = await this.GetGatewayFileFromGateway(); - if (listFile == null) - { - return; - } - //浠庝簯绔幏鍙栧浠界殑鏂囦欢 - bool result = await HdlBackupLogic.Current.LoadGatewayBackupInfo(BackupClassId, realGateway, listFile); - if (result == false) - { - //缃戝叧鎭㈠澶辫触 - string msg2 = Language.StringByID(R.MyInternationalizationString.uGatewayFileRecoverFail); - this.ShowMassage(ShowMsgType.Error, msg2); - return; - } - - HdlThreadLogic.Current.RunMain(() => - { - //鍏抽棴鑷韩 - this.CloseForm(); - }); - - //缃戝叧鎭㈠鎴愬姛 - string msg = Language.StringByID(R.MyInternationalizationString.uGatewayFileRecoverSuccess); - this.ShowMassage(ShowMsgType.Normal, msg); - }); } #endregion @@ -319,8 +322,7 @@ private void ShowEditorBackupForm(BackupListNameInfo fileInfo) { //鐢熸垚涓�涓脊绐楃敾闈� - var dialogForm = new DialogInputForm(); - dialogForm.AddForm(DialogFrameMode.OnlyInput); + var dialogForm = new DialogInputControl(); //缂栬緫澶囦唤 dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorBackup)); @@ -332,7 +334,7 @@ dialogForm.ComfirmClickEvent += ((txtvalue) => { //鐢婚潰鍏抽棴 - dialogForm.CloseForm(); + dialogForm.CloseDialog(); //鍚嶅瓧涓�鏍锋椂锛屼笉澶勭悊 if (txtvalue != fileInfo.BackupName) { @@ -341,44 +343,6 @@ } }); } - - #endregion - - #region 鈻� 鑾峰彇缃戝叧鏂囦欢_______________________ - - /// <summary> - /// 浠庣綉鍏宠幏鍙栧畠鐨勬枃浠� - /// </summary> - /// <returns></returns> - private async System.Threading.Tasks.Task<List<string>> GetGatewayFileFromGateway() - { - var fileData = await realGateway.FileTransferLsDirAsync(); - //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜 - string error = HdlCheckLogic.Current.CheckCommonErrorCode(fileData); - if (error != null) - { - this.ShowMassage(ShowMsgType.Error, error); - return null; - } - - if (fileData == null || fileData.fileTransferLsDiResponseData == null || fileData.fileTransferLsDiResponseData.Result != 0) - { - //鑾峰彇缃戝叧鏂囦欢澶辫触 - string msg = Language.StringByID(R.MyInternationalizationString.uGetGatewayFileFail); - this.ShowMassage(ShowMsgType.Error, msg); - return null; - } - var listFile = new List<string>(); - foreach (var filedata in fileData.fileTransferLsDiResponseData.Dir) - { - listFile.Add(filedata.File); - } - return listFile; - } - - #endregion - - #region 鈻� 涓�鑸柟娉昣__________________________ #endregion } -- Gitblit v1.8.0