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/HdlBackup/HdlBackupListForm.cs | 118 +++++++++++++++++++++++----------------------------------- 1 files changed, 47 insertions(+), 71 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs index b2c2409..140b49e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs @@ -70,13 +70,13 @@ /// <summary> /// 浠庝簯绔幏鍙栨暟鎹� /// </summary> - private async void SetBackupInfoToForm() + private void SetBackupInfoToForm() { //杩涘害鏉� this.ShowProgressBar(); //鑾峰彇app鐨勮嚜鍔ㄥ浠� - var autoData = await HdlBackupLogic.Current.GetBackupListNameFromDB(1); + var autoData = HdlBackupLogic.Current.GetBackupListNameFromDB(BackUpMode.A鑷姩澶囦唤); if (autoData == null) { //鍏抽棴杩涘害鏉� @@ -84,7 +84,7 @@ return; } //浠庝簯绔幏鍙栨暟鎹� - var pageData = await HdlBackupLogic.Current.GetBackupListNameFromDB(); + var pageData = HdlBackupLogic.Current.GetBackupListNameFromDB(BackUpMode.A鎵嬪姩澶囦唤); if (pageData == null) { //鍏抽棴杩涘害鏉� @@ -118,8 +118,8 @@ var listSort = new List<string>(); for (int i = 0; i < pageData.Count; i++) { - listSort.Add(pageData[i].CreatedOnUtc); - dic[pageData[i].CreatedOnUtc] = pageData[i]; + listSort.Add(pageData[i].ModifyTime); + dic[pageData[i].ModifyTime] = pageData[i]; } listSort.Sort(); @@ -163,13 +163,13 @@ } else { - txtText.Text = fileInfo.BackupName; + txtText.Text = fileInfo.FolderName; } //鏃堕棿 var btnTime = rowLayout.frameTable.AddBottomView("", 600); - if (fileInfo.CreatedOnUtc.Length >= 19) + if (fileInfo.ModifyTime.Length >= 13) { - btnTime.Text = UserCenterLogic.ConvertUtcTimeToLocalTime(fileInfo.CreatedOnUtc).ToString("yyyy.MM.dd HH:mm:ss"); + btnTime.Text = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(fileInfo.ModifyTime).ToString("yyyy.MM.dd HH:mm:ss"); } if (addLine == true) { @@ -283,10 +283,10 @@ /// <param name="BackupClassId"></param> private void LoadBackupInfo(string BackupClassId) { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { //浠庝簯绔幏鍙栧浠界殑鏂囦欢 - bool result = await HdlBackupLogic.Current.LoadAppBackupInfo(BackupClassId); + bool result = HdlBackupLogic.Current.LoadAppBackupInfo(BackupClassId); if (result == false) { //鏂囦欢鎭㈠澶辫触 @@ -295,12 +295,12 @@ return; } - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { //鍏抽棴鎵�鏈夌晫闈� - UserCenterLogic.CloseAllOpenForm(); + HdlFormLogic.Current.CloseAllOpenForm(null, false); //鍒囨崲鍒颁富椤� - UserView.UserPage.Instance.Fresh(); + UserView.UserPage.Instance.ReFreshControl(); }); //鏂囦欢鎭㈠鎴愬姛 @@ -319,10 +319,18 @@ /// <param name="backName"></param> private void UpLoadBackInfo(string backName) { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { + //缁戝畾杩樻病鏈夋垚鍔熺殑缃戝叧 + var result2 = HdlGatewayLogic.Current.ResetComandToBindBackupGateway(); + if (result2 == false) + { + //缁戝畾缃戝叧澶辫触,璇烽噸鏂颁笂浼� + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uBindGatewayFailPleaseUploadAgain)); + return; + } //鍒涘缓涓�涓浠藉悕瀛� - string backupClassId = await HdlBackupLogic.Current.CreatNewBackupNameToDB(backName); + string backupClassId = HdlBackupLogic.Current.CreatNewBackupNameToDB(backName, BackUpMode.A鎵嬪姩澶囦唤); if (backupClassId == null) { //鍒涘缓澶囦唤鍚嶅瓧澶辫触 @@ -333,7 +341,7 @@ } //涓婁紶鏁版嵁鍒颁簯绔� - bool result = await HdlBackupLogic.Current.UpLoadBackupFileToDB(backupClassId); + bool result = HdlBackupLogic.Current.UpLoadBackupFileToDB(backupClassId); if (result == false) { //鏂囦欢涓婁紶澶辫触 @@ -363,9 +371,17 @@ /// </summary> private void UpLoadAutoBackupInfo() { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { - int result = await HdlAutoBackupLogic.DoUpLoadAutoBackupData(); + //缁戝畾杩樻病鏈夋垚鍔熺殑缃戝叧 + var result2 = HdlGatewayLogic.Current.ResetComandToBindBackupGateway(); + if (result2 == false) + { + //缁戝畾缃戝叧澶辫触,璇烽噸鏂颁笂浼� + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uBindGatewayFailPleaseUploadAgain)); + return; + } + int result = HdlBackupLogic.Current.DoUpLoadAutoBackupDataByHand(); if (result == -1) { //鏂囦欢涓婁紶澶辫触 @@ -394,33 +410,22 @@ /// </summary> /// <param name="BackupClassId"></param> /// <param name="backName"></param> - private async void EditorBackInfo(string BackupClassId, string backName) + private void EditorBackInfo(string BackupClassId, string backName) { //寮�鍚繘搴︽潯 this.ShowProgressBar(); - var Pra = new EditorBackUpNamePra(); - Pra.BackupClassId = BackupClassId; - Pra.BackupName = backName; - //鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken - Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); + bool result = HdlBackupLogic.Current.EditorBackupName(BackupClassId, backName); + this.CloseProgressBar(); - bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/UpdateHomeAppGatewayName", true, Pra); - if (result == false) + if (result == true) { - //缂栬緫澶囦唤鍚嶇О澶辫触 - string msg = Language.StringByID(R.MyInternationalizationString.uEditorBackupNameFail); - this.ShowMassage(ShowMsgType.Error, msg); - //鍏抽棴 - this.CloseProgressBar(); - return; + HdlThreadLogic.Current.RunThread(() => + { + //浠庝簯绔幏鍙栨暟鎹� + this.SetBackupInfoToForm(); + }); } - - HdlThreadLogic.Current.RunThread(() => - { - //浠庝簯绔幏鍙栨暟鎹� - this.SetBackupInfoToForm(); - }); } #endregion @@ -432,16 +437,9 @@ /// </summary> /// <param name="BackupClassId"></param> /// <param name="showMode"></param> - public async void DeleteBackInfo(string BackupClassId, ShowErrorMode showMode = ShowErrorMode.YES) + public void DeleteBackInfo(string BackupClassId, ShowErrorMode showMode = ShowErrorMode.YES) { - //杩涘害鏉� - this.ShowProgressBar(); - - bool success = await HdlBackupLogic.Current.DeleteDbBackupData(BackupClassId); - - //鍏抽棴杩涘害鏉� - this.CloseProgressBar(); - + bool success = HdlBackupLogic.Current.DeleteDbBackupData(BackupClassId); if (success == false) { if (showMode == ShowErrorMode.YES) @@ -477,7 +475,7 @@ dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorBackup)); //璇疯緭鍏ュ浠藉悕绉� dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName)); - dialogForm.Text = fileInfo.BackupName; + dialogForm.Text = fileInfo.FolderName; //鎸変笅纭鎸夐挳 dialogForm.ComfirmClickEvent += ((textValue) => @@ -492,7 +490,7 @@ dialogForm.CloseDialog(); //鍚嶅瓧涓�鏍锋椂锛屼笉澶勭悊 - if (textValue != fileInfo.BackupName) + if (textValue != fileInfo.FolderName) { //缂栬緫澶囦唤鍚嶇О this.EditorBackInfo(fileInfo.Id, textValue); @@ -533,28 +531,6 @@ #endregion #region 鈻� 涓�鑸柟娉昣__________________________ - - /// <summary> - /// 鎶婃湰鍦版墍鏈夋枃浠剁Щ鍔ㄥ埌鑷姩澶囦唤鏂囦欢澶� - /// </summary> - private void CopyLocationAllFileToAutoBackDirectory() - { - List<string> listAllFile = Shared.Common.Global.FileListByHomeId(); - - string strroot = Common.Config.Instance.FullPath; - string autoPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory); - foreach (string file in listAllFile) - { - //鍒ゆ柇鏄惁鏄簲璇ヤ笂浼犵殑鏂囦欢 - if (HdlBackupLogic.Current.IsNotUpLoadFile(file) == true) - { - continue; - } - string sourseName = System.IO.Path.Combine(strroot, file); - string newName = System.IO.Path.Combine(autoPath, file); - System.IO.File.Copy(sourseName, newName, true); - } - } /// <summary> /// 妫�娴嬪鑰冨悕绉� -- Gitblit v1.8.0