From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 17 十二月 2020 09:07:13 +0800 Subject: [PATCH] 新云端Ver1.3 --- ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs | 146 ++++++++++++++++++++++++++---------------------- 1 files changed, 78 insertions(+), 68 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs index 334034f..b43b043 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs @@ -85,7 +85,7 @@ /// <summary> /// 浠庝簯绔幏鍙栨暟鎹� /// </summary> - private async void SetBackupInfoToForm() + private void SetBackupInfoToForm() { this.nowSelectBackId = string.Empty; this.nowbtnSelect = null; @@ -93,9 +93,18 @@ //杩涘害鏉� this.ShowProgressBar(); - //浠庝簯绔幏鍙栨暟鎹� - var pageData = await HdlBackupLogic.Current.GetBackupListNameFromDB(2, HdlGatewayLogic.Current.GetGatewayId(realGateway)); - if (pageData == null) + //鑾峰彇鑷姩澶囦唤鐨勬暟鎹� + var listAutoData = HdlGatewayBackupLogic.Current.GetGatewayBackupListFromDb(realGateway.GwId, BackUpMode.A鑷姩澶囦唤); + if (listAutoData == null) + { + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(ShowReLoadMode.YES); + return; + } + + //浠庝簯绔幏鍙栨墜鍔ㄥ浠芥暟鎹� + var listHandData = HdlGatewayBackupLogic.Current.GetGatewayBackupListFromDb(realGateway.GwId, BackUpMode.A鎵嬪姩澶囦唤); + if (listHandData == null) { //鍏抽棴杩涘害鏉� this.CloseProgressBar(ShowReLoadMode.YES); @@ -108,14 +117,20 @@ { listView.RemoveAll(); listView.RecoverHeight(); - for (int i = 0; i < pageData.Count; i++) + if (listAutoData.Count > 0) + { + //娣诲姞鑷姩澶囦唤琛� + this.AddRowlayout(listAutoData[0], listAutoData.Count > 0, true); + } + + for (int i = 0; i < listHandData.Count; i++) { //娣诲姞澶囦唤琛� - this.AddRowlayout(pageData[i], i != pageData.Count - 1); + this.AddRowlayout(listHandData[i], i != listHandData.Count - 1, false); } this.btnDownload?.RemoveFromParent(); - if (pageData.Count > 0) + if (listAutoData.Count > 0 || listHandData.Count > 0) { //涓嬭浇 this.btnDownload = new BottomClickButton(); @@ -134,7 +149,7 @@ HdlThreadLogic.Current.RunThread(() => { //璇诲彇澶囦唤鏂囨。 - bool result = HdlGatewayBackupLogic.Current.RecoverGateway(this.realGateway, this.nowSelectBackId); + bool result = HdlGatewayBackupLogic.Current.RecoverGateway(this.realGateway.GwId, this.nowSelectBackId); if (result == true) { HdlThreadLogic.Current.RunMain(() => @@ -149,7 +164,6 @@ //璋冩暣鐪熷疄楂樺害 listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(23)); } - }); } @@ -162,25 +176,24 @@ /// </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); //澶囦唤鍚嶅瓧 - var txtText = rowLayout.frameTable.AddLeftCaption(fileInfo.BackupName, 700, 60); - txtText.TextSize = 15; - txtText.Y = Application.GetRealHeight(12) + rowLayout.chidrenYaxis; - rowLayout.frameTable.AddChidren(txtText, ChidrenBindMode.BindEventOnly); - //鏃堕棿 2019-11-11T11:31:01 - var btnTime = rowLayout.frameTable.AddLeftCaption("", 600, 50, true); - btnTime.Y = Application.GetRealHeight(72) + rowLayout.chidrenYaxis; - btnTime.TextSize = 12; - btnTime.TextColor = UserCenterColor.Current.TextGrayColor1; - rowLayout.frameTable.AddChidren(btnTime, ChidrenBindMode.BindEventOnly); - if (fileInfo.CreatedOnUtc.Length >= 19) + var txtText = rowLayout.frameTable.AddTopView(fileInfo.FolderName, 700); + if (isAuto == true) { - btnTime.Text = fileInfo.CreatedOnUtc.Replace("-", ".").Replace("T", " "); + txtText.TextID = R.MyInternationalizationString.uAutoBackup; + } + + //鏃堕棿 + var btnTime = rowLayout.frameTable.AddBottomView("", 600); + if (fileInfo.ModifyTime.Length == 13) + { + btnTime.Text = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(fileInfo.ModifyTime).ToString("yyyy.MM.dd HH:mm:ss"); } //搴曠嚎 if (addLine == true) @@ -211,26 +224,30 @@ } }; - //缂栬緫 - var btnEditor = rowLayout.AddEditorControl(); - btnEditor.ButtonClickEvent += (sender, e) => + //鑷姩澶囦唤涓嶅厑璁哥紪杈� + if (isAuto == false) { - //鏄剧ず缂栬緫澶囪�冨悕鐢婚潰 - this.ShowEditorBackupForm(fileInfo); - }; - - //鍒犻櫎 - var btnDelete = rowLayout.AddDeleteControl(); - btnDelete.ButtonClickEvent += (sender, e) => - { - //纭鍒犻櫎璇ュ浠芥暟鎹�? - string msg = Language.StringByID(R.MyInternationalizationString.uDoDeleteBackupMsg); - this.ShowMassage(ShowMsgType.Confirm, msg, () => + //缂栬緫 + var btnEditor = rowLayout.AddEditorControl(); + btnEditor.ButtonClickEvent += (sender, e) => { - //鍒犻櫎澶囦唤鏂囨。 - this.DeleteBackInfo(fileInfo.Id); - }); - }; + //鏄剧ず缂栬緫澶囪�冨悕鐢婚潰 + this.ShowEditorBackupForm(fileInfo); + }; + + //鍒犻櫎 + var btnDelete = rowLayout.AddDeleteControl(); + btnDelete.ButtonClickEvent += (sender, e) => + { + //纭鍒犻櫎璇ュ浠芥暟鎹�? + string msg = Language.StringByID(R.MyInternationalizationString.uDoDeleteBackupMsg); + this.ShowMassage(ShowMsgType.Confirm, msg, () => + { + //鍒犻櫎澶囦唤鏂囨。 + this.DeleteBackInfo(fileInfo.Id); + }); + }; + } } #endregion @@ -240,23 +257,21 @@ /// <summary> /// 缂栬緫澶囦唤鍚嶇О /// </summary> - /// <param name="BackupClassId"></param> + /// <param name="backupClassId"></param> /// <param name="backName"></param> - private async void EditorBackInfo(string BackupClassId, string backName) + private void EditorBackInfo(string backupClassId, string backName) { - var Pra = new EditorBackUpNamePra(); - Pra.BackupClassId = BackupClassId; - Pra.BackupName = backName; - //鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken - Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); - - bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/UpdateHomeAppGatewayName", true, Pra); + var result = HdlGatewayBackupLogic.Current.EditorGatewayBackupName(backupClassId, backName); if (result == false) { return; } - this.SetBackupInfoToForm(); + HdlThreadLogic.Current.RunThread(() => + { + //浠庝簯绔幏鍙栨暟鎹� + this.SetBackupInfoToForm(); + }); } #endregion @@ -266,20 +281,24 @@ /// <summary> /// 鍒犻櫎澶囦唤鏂囨。 /// </summary> - /// <param name="BackupClassId"></param> - private async void DeleteBackInfo(string BackupClassId) + /// <param name="backupClassId"></param> + private void DeleteBackInfo(string backupClassId) { - bool success = await HdlBackupLogic.Current.DeleteDbBackupData(BackupClassId); + bool success = HdlGatewayBackupLogic.Current.DeleteGatewayBackup(this.realGateway.GwId, backupClassId); if (success == false) { return; } - if (this.nowSelectBackId == BackupClassId) + if (this.nowSelectBackId == backupClassId) { this.nowSelectBackId = string.Empty; this.nowbtnSelect = null; } - this.SetBackupInfoToForm(); + HdlThreadLogic.Current.RunThread(() => + { + //浠庝簯绔幏鍙栨暟鎹� + this.SetBackupInfoToForm(); + }); } #endregion @@ -294,22 +313,13 @@ private void ShowEditorBackupForm(BackupListNameInfo fileInfo) { //鐢熸垚涓�涓脊绐楃敾闈� - var dialogForm = new DialogInputForm(); - dialogForm.AddForm(DialogFrameMode.OnlyInput); - - //缂栬緫澶囦唤 - dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorBackup)); - //璇疯緭鍏ュ娉ㄥ悕绉� - dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup)); - dialogForm.Text = fileInfo.BackupName; - - //鎸変笅纭鎸夐挳 - dialogForm.ComfirmClickEvent += ((txtvalue) => + this.ShowDialogInputForm(Language.StringByID(R.MyInternationalizationString.uEditorBackup), fileInfo.FolderName, + Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName), (contr, txtvalue) => { //鐢婚潰鍏抽棴 - dialogForm.CloseForm(); + contr.CloseDialog(); //鍚嶅瓧涓�鏍锋椂锛屼笉澶勭悊 - if (txtvalue != fileInfo.BackupName) + if (txtvalue != fileInfo.FolderName) { //缂栬緫澶囦唤鍚嶇О this.EditorBackInfo(fileInfo.Id, txtvalue); -- Gitblit v1.8.0