From 9c16d3614d9b88c637f967518a329f239fcd3aaf Mon Sep 17 00:00:00 2001
From: lss <316519258@qq.com>
Date: 星期五, 12 六月 2020 09:22:04 +0800
Subject: [PATCH] 2020.06.12

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs |   59 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs
index 1a83c35..e855dda 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs
@@ -58,15 +58,15 @@
                 return 0;
             }
 
-            //寮�鍚繘搴︽潯
-            ProgressBar.SetMaxValue(listEditor.Count + listDelete.Count);
-            ProgressBar.Show();
+            //寮�鍚繘搴︽潯 姝e湪涓婁紶澶囦唤鏂囦欢
+            ProgressFormBar.Current.Start();
+            ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uBackupFileUploading));
 
             //涓婁紶鏂囦欢鍒颁簯绔�
             bool result = await UpLoadBackupFileToDB(listEditor);
             if (result == false)
             {
-                ProgressBar.Close();
+                ProgressFormBar.Current.Close();
                 return -1;
             }
 
@@ -74,11 +74,11 @@
             result = await DoDeleteFileFromDB(listDelete);
             if (result == false)
             {
-                ProgressBar.Close();
+                ProgressFormBar.Current.Close();
                 return -1;
             }
 
-            ProgressBar.Close();
+            ProgressFormBar.Current.Close();
 
             return 1;
         }
@@ -90,9 +90,11 @@
         /// <returns></returns>
         private async static Task<bool> UpLoadBackupFileToDB(List<string> listFile)
         {
+            int listFileCount = listFile.Count;
             string backUpDir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory);
-            foreach (string file in listFile)
+            for (int i = 0; i < listFile.Count; i++)
             {
+                string file = listFile[i];
                 var datainfo = new FileInfoData();
                 datainfo.BackupFileName = file;
                 datainfo.BackupFileContent = ReadDirctoryFileByName(backUpDir, file);
@@ -110,7 +112,7 @@
                     return false;
                 }
                 //璁剧疆杩涘害鍊�
-                ProgressBar.SetValue(list.Count);
+                ProgressFormBar.Current.SetValue(i + 1, listFileCount);
             }
             return true;
         }
@@ -320,6 +322,15 @@
             //鍒涘缓涓�涓┖鏂囦欢
             var file = System.IO.File.Create(newFile);
             file.Close();
+
+            //鑷姩澶囦唤鐩綍
+            strBackPath = System.IO.Path.Combine(strroot, DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupDirectory);
+            //濡傛灉澶囦唤鍒楄〃閲岄潰鏈夎繖涓笢瑗跨殑璇濓紝绉婚櫎鎺�
+            string delFile = System.IO.Path.Combine(strBackPath, fileName);
+            if (System.IO.File.Exists(delFile) == true)
+            {
+                System.IO.File.Delete(delFile);
+            }
         }
 
         #endregion
@@ -327,7 +338,7 @@
         #region 鈻� 鍚屾鏁版嵁___________________________
 
         /// <summary>
-        /// 鍚屾浜戠鏁版嵁(浠呴檺APP鍚姩涔嬪悗) -1锛氬紓甯�   0:宸茬粡鍚屾杩囷紝涓嶉渶瑕佸悓姝�  1锛氭甯稿悓姝�  
+        /// 鍚屾浜戠鏁版嵁(浠呴檺APP鍚姩涔嬪悗) -1锛氬紓甯�   0:宸茬粡鍚屾杩囷紝涓嶉渶瑕佸悓姝�  1锛氭甯稿悓姝�  2:娌℃湁鑷姩澶囦唤鏁版嵁
         /// </summary>
         /// <returns></returns>
         public static async Task<int> SynchronizeDbAutoBackupData()
@@ -337,8 +348,8 @@
             //濡傛灉鏈湴宸茬粡鎷ユ湁浜嗚繖涓枃浠讹紝鍒欒鏄庝笉鏄柊鎵嬫満锛屼笉鍐嶈嚜鍔ㄨ繕鍘�
             if (System.IO.File.Exists(checkFile) == true)
             {
-                //鍚屾鏈嶅姟鍣ㄧ殑鍙栨秷浜嗙殑鍒嗕韩鍐呭
-                await HdlShardLogic.Current.SynchronizeDeleteSharedContent();
+                //鍚屾鏈嶅姟鍣ㄧ殑鍒嗕韩鍐呭
+                await HdlShardLogic.Current.SynchronizeDbSharedContent();
                 return 0;
             }
 
@@ -366,13 +377,14 @@
                 //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚鍚屾)
                 var file = System.IO.File.Create(checkFile);
                 file.Close();
-                return 1;
+                return 2;
             }
             //鑷姩澶囦唤鍙湁涓�涓�
             string backId = data[0].Id;
 
-            //寮哄埗鎸囧畾鏂囨湰闄勫姞淇℃伅锛氳处鍙锋暟鎹悓姝ヤ腑
-            ProgressBar.SetAppendText(Language.StringByID(R.MyInternationalizationString.uAccountDataIsSynchronizing));
+            //璐﹀彿鏁版嵁鍚屾涓�
+            ProgressFormBar.Current.Start();
+            ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uAccountDataIsSynchronizing));
 
             //浠庝簯绔幏鍙栧浠界殑鏂囦欢锛岀劧鍚庡瓨鍏ユ湰鍦版寚瀹氱殑涓存椂鏂囦欢澶�
             string tempDir = await HdlBackupLogic.Current.GetBackFileFromDBAndSetToLocation(backId);
@@ -389,12 +401,12 @@
             //娌℃湁閿欒鐨勮瘽锛屽垯绉诲姩鍒板綋鍓嶄綇瀹呮枃浠跺す涓嬮潰
             Global.MoveDirectoryFileToHomeDirectory(tempDir, true);
 
-            //鍚屾鏈嶅姟鍣ㄧ殑鍙栨秷浜嗙殑鍒嗕韩鍐呭
-            await HdlShardLogic.Current.SynchronizeDeleteSharedContent();
-
             //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚鍚屾)
             var file2 = System.IO.File.Create(checkFile);
             file2.Close();
+
+            //閲嶆柊鍒锋柊浣忓畢瀵硅薄
+            UserCenterLogic.RefreshHomeObject();
 
             return 1;
         }
@@ -503,9 +515,9 @@
             string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.AutoBackupNotPromptedFile);
             if (System.IO.File.Exists(fullName) == false)
             {
-                Application.RunOnMainThread(() =>
+                HdlThreadLogic.Current.RunMain(() =>
                 {
-                    var form = new HdlBackup.HdlAutoBackupSettionForm();
+                    var form = new HdlBackup.HdlAutoBackupForm();
                     form.AddForm();
                 });
                 return;
@@ -520,9 +532,9 @@
             }
             if (info.Day == 0)
             {
-                Application.RunOnMainThread(() =>
+                HdlThreadLogic.Current.RunMain(() =>
                 {
-                    var form = new HdlBackup.HdlAutoBackupSettionForm();
+                    var form = new HdlBackup.HdlAutoBackupForm();
                     form.AddForm();
                 });
                 return;
@@ -533,11 +545,12 @@
             //鏃堕棿宸茬粡瓒呰繃
             if (intDay > info.Day)
             {
-                Application.RunOnMainThread(() =>
+                HdlThreadLogic.Current.RunMain(() =>
                 {
-                    var form = new HdlBackup.HdlAutoBackupSettionForm();
+                    var form = new HdlBackup.HdlAutoBackupForm();
                     form.AddForm();
                 });
+                return;
             }
         }
 

--
Gitblit v1.8.0