From da9285368099529de4f6aa92be55297d05dc63dc Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 29 五月 2020 09:45:11 +0800
Subject: [PATCH] 2020-05-29-1
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs | 73 +++++++++++++++++++++++-------------
1 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlAutoBackupLogic.cs
index 5e03dc6..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,19 +348,19 @@
//濡傛灉鏈湴宸茬粡鎷ユ湁浜嗚繖涓枃浠讹紝鍒欒鏄庝笉鏄柊鎵嬫満锛屼笉鍐嶈嚜鍔ㄨ繕鍘�
if (System.IO.File.Exists(checkFile) == true)
{
- //鍚屾鏈嶅姟鍣ㄧ殑鍙栨秷浜嗙殑鍒嗕韩鍐呭
- await HdlShardLogic.Current.SynchronizeDeleteSharedContent();
+ //鍚屾鏈嶅姟鍣ㄧ殑鍒嗕韩鍐呭
+ await HdlShardLogic.Current.SynchronizeDbSharedContent();
return 0;
}
- //鍒涘缓涓�涓┖鏂囦欢
- var file = System.IO.File.Create(checkFile);
- file.Close();
//鏆傛椂涓嶆敮鎸佹垚鍛�
if (UserCenterResourse.UserInfo.AuthorityNo == 3)
{
//鍚屾鏈嶅姟鍣ㄧ殑鍒嗕韩鍐呭
await HdlShardLogic.Current.SynchronizeDbSharedContent();
+ //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚鍚屾)
+ var file = System.IO.File.Create(checkFile);
+ file.Close();
return 1;
}
@@ -357,21 +368,23 @@
var data = await HdlBackupLogic.Current.GetBackupListNameFromDB(1);
if (data == null)
{
- //寮傚父,鍒犻櫎妫�娴嬫枃浠�
- System.IO.File.Delete(checkFile);
return -1;
}
if (data.Count == 0)
{
//鍚屾鏈嶅姟鍣ㄧ殑鍒嗕韩鍐呭
await HdlShardLogic.Current.SynchronizeDbSharedContent();
- return 1;
+ //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚鍚屾)
+ var file = System.IO.File.Create(checkFile);
+ file.Close();
+ 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);
@@ -388,8 +401,13 @@
//娌℃湁閿欒鐨勮瘽锛屽垯绉诲姩鍒板綋鍓嶄綇瀹呮枃浠跺す涓嬮潰
Global.MoveDirectoryFileToHomeDirectory(tempDir, true);
- //鍚屾鏈嶅姟鍣ㄧ殑鍙栨秷浜嗙殑鍒嗕韩鍐呭
- await HdlShardLogic.Current.SynchronizeDeleteSharedContent();
+ //鍒涘缓涓�涓┖鏂囦欢(鏍囪瘑宸茬粡瀹屾垚鍚屾)
+ var file2 = System.IO.File.Create(checkFile);
+ file2.Close();
+
+ //閲嶆柊鍒锋柊浣忓畢瀵硅薄
+ UserCenterLogic.RefreshHomeObject();
+
return 1;
}
@@ -497,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;
@@ -514,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;
@@ -527,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