From eb424d24e39bab4a245725f35deab3f234ea0f13 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 13 十二月 2019 10:48:50 +0800
Subject: [PATCH] 2019.12.13
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs | 85 +++++++++++++++++-------------------------
1 files changed, 35 insertions(+), 50 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs
index 8fd93bc..cb7d026 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlBackupLogic.cs
@@ -89,7 +89,7 @@
}
/// <summary>
- /// <para>浠庝簯绔幏鍙栧浠界殑鏂囦欢锛岀劧鍚庡瓨鍏ユ湰鍦版寚瀹氱殑涓存椂鏂囦欢澶�(鍑芥暟鍐呴儴鏈夎繘搴︽潯)</para>
+ /// <para>浠庝簯绔幏鍙栧浠界殑鏂囦欢锛岀劧鍚庡瓨鍏ユ湰鍦版寚瀹氱殑涓存椂鏂囦欢澶�</para>
/// <para>杩斿洖鏂囦欢澶瑰悕瀛�(閲岄潰瀛樻斁鐫�鍏ㄩ儴鐨勬枃浠�),杩斿洖null鏃讹紝浠h〃澶辫触</para>
/// </summary>
/// <param name="BackupClassId">BackupClassId</param>
@@ -106,22 +106,17 @@
string newDir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.DownLoadBackupTempDirectory);
Global.CreateEmptyDirectory(newDir, true);
- //寮�鍚繘搴︽潯
- ProgressBar.Show();
-
//鑾峰彇杩欎釜澶囦唤涓嬮潰鏈夊灏戜釜鏂囦欢
List<string> listFile = await GetBackFileIDFromDB(BackupClassId, IsGatewayAutoBackup, ZigbeeUniqueId);
if (listFile == null)
{
//鍏抽棴杩涘害鏉�
- ProgressBar.Close();
+ ProgressFormBar.Current.Close();
//鍏佽鎸夌郴缁熺殑杩斿洖閿�
Shared.Common.CommonPage.BackKeyCanClick = true;
UserCenterResourse.Option.AppCanSignout = true;
return null;
}
- //璁剧疆鏈�澶у��
- ProgressBar.SetMaxValue(listFile.Count);
var pra = new LoadBackInfoPra();
pra.BackupClassId = BackupClassId;
@@ -131,13 +126,15 @@
pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
//涓�涓釜鐨勪笅杞芥枃浠�
- foreach (string fileName in listFile)
+ int listFileCount = listFile.Count;
+ for (int i = 0; i < listFile.Count; i++)
{
+ string fileName = listFile[i];
//璐﹀彿宸茬粡閫�鍑�
if (HdlCheckLogic.Current.IsAccountLoginOut() == true)
{
//鍏抽棴杩涘害鏉�
- ProgressBar.Close(true);
+ ProgressFormBar.Current.Close();
//鍏佽鎸夌郴缁熺殑杩斿洖閿�
Shared.Common.CommonPage.BackKeyCanClick = true;
UserCenterResourse.Option.AppCanSignout = true;
@@ -150,7 +147,7 @@
if (result == null)
{
//鍏抽棴杩涘害鏉�
- ProgressBar.Close();
+ ProgressFormBar.Current.Close();
//鍏佽鎸夌郴缁熺殑杩斿洖閿�
Shared.Common.CommonPage.BackKeyCanClick = true;
UserCenterResourse.Option.AppCanSignout = true;
@@ -159,10 +156,10 @@
//灏嗚緭鍏ュ啓鍏ユ湰鍦扮殑涓存椂鏂囦欢澶�
Global.WriteFileToDirectoryByBytes(newDir, fileName, result);
//璁剧疆杩涘害鍊�
- ProgressBar.SetValue(1);
+ ProgressFormBar.Current.SetValue(i + 1, listFileCount);
}
//鍏抽棴杩涘害鏉�
- ProgressBar.Close();
+ ProgressFormBar.Current.Close();
//鍏佽鎸夌郴缁熺殑杩斿洖閿�
Shared.Common.CommonPage.BackKeyCanClick = true;
UserCenterResourse.Option.AppCanSignout = true;
@@ -245,9 +242,9 @@
/// <param name="BackupClassId">澶囦唤涓婚敭ID</param>
/// <param name="ManualBackupType">鎵嬪姩澶囦唤绫诲瀷(0:App鎵嬪姩澶囦唤,2锛氱綉鍏虫墜鍔ㄥ浠�)</param>
/// <param name="upPath">鎸囧畾涓婁紶鐨勬槸鍝釜鏂囦欢澶圭殑鏂囦欢(鍏ㄨ矾寰�),涓嶆寚瀹氭椂锛屼笂浼犵殑鏄湰鍦拌矾寰勪笅鐨勬枃浠�</param>
- /// <param name="setBarMaxValue">鏄惁璁剧疆杩涘害鏉$殑鏈�澶у��(杩欎釜涓滆タ涓�鑸笉鐢ㄥ姩瀹�)</param>
+ /// <param name="showBar">鏄惁璁剧疆鏄剧ず杩涘害鏉�</param>
/// <returns></returns>
- public async Task<bool> UpLoadBackupFileToDB(string BackupClassId, int ManualBackupType = 0, string upPath = "", bool setBarMaxValue = true)
+ public async Task<bool> UpLoadBackupFileToDB(string BackupClassId, int ManualBackupType = 0, string upPath = "", bool showBar = true)
{
List<string> listAllFile = null;
//鏂囦欢澶圭殑鍏ㄨ矾寰�
@@ -285,10 +282,12 @@
}
//寮�鍚繘搴︽潯
- if (setBarMaxValue == true)
+ int listFileCount = listAllFile.Count;
+ if (showBar == true)
{
- ProgressBar.SetMaxValue(listAllFile.Count);
- ProgressBar.Show();
+ //寮�鍚繘搴︽潯 姝e湪涓婁紶澶囦唤鏂囦欢
+ ProgressFormBar.Current.Start();
+ ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uBackupFileUploading));
}
//涓嶅厑璁告寜绯荤粺鐨勮繑鍥為敭
@@ -297,13 +296,14 @@
//浣犺涓轰粈涔堣繖閲屼笉鍒嗕竴涓嚱鏁板嚭鏉ワ紙鐞嗚涓婃槸鍒嗗嚱鏁板嚭鏉ョ殑锛�
//鏄洜涓哄鏋滃垎鍑芥暟鐨勮瘽锛屼細鍑虹幇鍙岄噸寮傛锛屽鑷翠富绾跨▼鐨勮繘搴︽潯鐨勭櫨鍒嗘瘮姘歌繙瀹氭0%
- foreach (string file in listNormalFile)
+ for (int i = 0; i < listNormalFile.Count; i++)
{
+ string file = listNormalFile[i];
//璐﹀彿宸茬粡閫�鍑�
if (HdlCheckLogic.Current.IsAccountLoginOut() == true)
{
//鍏抽棴杩涘害鏉�
- ProgressBar.Close(true);
+ ProgressFormBar.Current.Close();
//鍏佽鎸夌郴缁熺殑杩斿洖閿�
Shared.Common.CommonPage.BackKeyCanClick = true;
UserCenterResourse.Option.AppCanSignout = true;
@@ -328,23 +328,24 @@
if (falge == false)
{
//鍏抽棴杩涘害鏉�
- ProgressBar.Close();
+ ProgressFormBar.Current.Close();
//鍏佽鎸夌郴缁熺殑杩斿洖閿�
Shared.Common.CommonPage.BackKeyCanClick = true;
UserCenterResourse.Option.AppCanSignout = true;
return false;
}
//璁剧疆杩涘害鍊�
- ProgressBar.SetValue(list.Count);
+ ProgressFormBar.Current.SetValue(i + 1, listFileCount);
}
- foreach (string file in listPicFile)
+ for (int i = 0; i < listPicFile.Count; i++)
{
+ string file = listPicFile[i];
//璐﹀彿宸茬粡閫�鍑�
if (HdlCheckLogic.Current.IsAccountLoginOut() == true)
{
//鍏抽棴杩涘害鏉�
- ProgressBar.Close(true);
+ ProgressFormBar.Current.Close();
//鍏佽鎸夌郴缁熺殑杩斿洖閿�
Shared.Common.CommonPage.BackKeyCanClick = true;
UserCenterResourse.Option.AppCanSignout = true;
@@ -359,14 +360,14 @@
if (result == false)
{
//鍏抽棴杩涘害鏉�
- ProgressBar.Close();
+ ProgressFormBar.Current.Close();
//鍏佽鎸夌郴缁熺殑杩斿洖閿�
Shared.Common.CommonPage.BackKeyCanClick = true;
UserCenterResourse.Option.AppCanSignout = true;
return false;
}
//璁剧疆杩涘害鍊�
- ProgressBar.SetValue(listPic.Count);
+ ProgressFormBar.Current.SetValue(i + 1 + listNormalFile.Count, listFileCount);
}
//涓婁紶Log澶囦唤
@@ -377,7 +378,7 @@
}
//杩涘害鏉″叧闂�
- ProgressBar.Close();
+ ProgressFormBar.Current.Close();
//鍏佽鎸夌郴缁熺殑杩斿洖閿�
Shared.Common.CommonPage.BackKeyCanClick = true;
UserCenterResourse.Option.AppCanSignout = true;
@@ -612,12 +613,20 @@
/// <param name="BackupClassId"></param>
public async Task<bool> LoadAppBackupInfo(string BackupClassId)
{
+ //鎵撳紑杩涘害鏉� 姝e湪鑾峰彇澶囦唤鏂囦欢鍒楄〃
+ ProgressFormBar.Current.Start();
+ ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uBackupFileListGetting));
+
//浠庝簯绔幏鍙栧浠界殑鏂囦欢锛岀劧鍚庡瓨鍏ユ湰鍦扮殑涓存椂鏂囦欢澶�
string tempDirectory = await GetBackFileFromDBAndSetToLocation(BackupClassId);
if (tempDirectory == null)
{
+ //鍏抽棴杩涘害鏉�
+ ProgressFormBar.Current.Close();
return false;
}
+ //鍏抽棴杩涘害鏉�
+ ProgressFormBar.Current.Close();
//濡傛灉璇诲彇鍒扮殑鏂囦欢瀹屽叏娌℃湁闂锛屽垯娓呯悊鏈湴鐨勬枃浠�
UserCenterLogic.DeleteAllLocationFile(false);
@@ -632,30 +641,6 @@
UserCenterLogic.RefreshAllMemory();
return true;
- }
-
- /// <summary>
- /// 璇诲彇缃戝叧澶囦唤鏂囨。(鍑芥暟鍐呴儴鏈夎繘搴︽潯)
- /// </summary>
- /// <param name="BackupClassId"></param>
- /// <param name="zbGateway">缃戝叧瀵硅薄(璇蜂紶鍏ョ湡瀹炵墿鐞嗙綉鍏冲璞�)</param>
- /// <param name="listGatewayFile">缃戝叧鐜版湁鐨勬枃浠跺悕</param>
- public async Task<bool> LoadGatewayBackupInfo(string BackupClassId, ZigBee.Device.ZbGateway zbGateway, List<string> listGatewayFile)
- {
- //娣诲姞闄勫姞鎯呮姤:鑾峰彇澶囦唤鏁版嵁
- ProgressBar.SetAppendText(Language.StringByID(R.MyInternationalizationString.uGetBackupData));
- //浠庝簯绔幏鍙栧浠界殑鏂囦欢锛岀劧鍚庡瓨鍏ユ湰鍦扮殑涓存椂鏂囦欢澶�
- string tempDirectory = await GetBackFileFromDBAndSetToLocation(BackupClassId, false, HdlGatewayLogic.Current.GetGatewayId(zbGateway));
- //娓呯┖闄勫姞鎯呮姤
- ProgressBar.SetAppendText(string.Empty);
-
- if (tempDirectory == null)
- {
- return false;
- }
-
- //鎭㈠缃戝叧閰嶇疆
- return await HdlGatewayLogic.Current.RecoverGatewaySettion(zbGateway, listGatewayFile, tempDirectory);
}
#endregion
--
Gitblit v1.8.0