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 | 167 ++++++++++++++++++++++---------------------------------
1 files changed, 67 insertions(+), 100 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlBackupListForm.cs
index c6e74c1..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();
@@ -155,7 +155,7 @@
btnPoint.UnSelectedImagePath = "Item/DownLoad.png";
//澶囦唤鍚嶅瓧
- var txtText = rowLayout.frameTable.AddLeftCaption("", 700, 60);
+ var txtText = rowLayout.frameTable.AddTopView("", 700);
if (autoBack == true)
{
//鑷姩澶囦唤
@@ -163,22 +163,13 @@
}
else
{
- txtText.Text = fileInfo.BackupName;
+ txtText.Text = fileInfo.FolderName;
}
- txtText.TextSize = 15;
- //杩欎釜鍧愭爣鏈夌偣鐗规畩
- txtText.Y = Application.GetRealHeight(12) + rowLayout.chidrenYaxis;
- rowLayout.frameTable.AddChidren(txtText, ChidrenBindMode.BindEventOnly);
//鏃堕棿
- 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 btnTime = rowLayout.frameTable.AddBottomView("", 600);
+ if (fileInfo.ModifyTime.Length >= 13)
{
- btnTime.Text = fileInfo.CreatedOnUtc.Replace("-", ".").Replace("T", " ");
+ btnTime.Text = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(fileInfo.ModifyTime).ToString("yyyy.MM.dd HH:mm:ss");
}
if (addLine == true)
{
@@ -228,20 +219,20 @@
//鏄剧ず缂栬緫澶囪�冨悕鐢婚潰
this.ShowEditorBackupForm(fileInfo);
};
- }
- //鍒犻櫎
- var btnDelete = rowLayout.AddDeleteControl();
- btnDelete.ButtonClickEvent += (sender, e) =>
- {
- //纭鍒犻櫎璇ュ浠芥暟鎹�?
- string msg = Language.StringByID(R.MyInternationalizationString.uDoDeleteBackupMsg);
- this.ShowMassage(ShowMsgType.Confirm, msg, () =>
+ //鍒犻櫎
+ var btnDelete = rowLayout.AddDeleteControl();
+ btnDelete.ButtonClickEvent += (sender, e) =>
{
- //鍒犻櫎澶囦唤鏂囨。
- this.DeleteBackInfo(fileInfo.Id, ShowErrorMode.YES);
- });
- };
+ //纭鍒犻櫎璇ュ浠芥暟鎹�?
+ string msg = Language.StringByID(R.MyInternationalizationString.uDoDeleteBackupMsg);
+ this.ShowMassage(ShowMsgType.Confirm, msg, () =>
+ {
+ //鍒犻櫎澶囦唤鏂囨。
+ this.DeleteBackInfo(fileInfo.Id, ShowErrorMode.YES);
+ });
+ };
+ }
}
/// <summary>
@@ -292,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)
{
//鏂囦欢鎭㈠澶辫触
@@ -304,12 +295,12 @@
return;
}
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
//鍏抽棴鎵�鏈夌晫闈�
- UserCenterLogic.CloseAllOpenForm();
+ HdlFormLogic.Current.CloseAllOpenForm(null, false);
//鍒囨崲鍒颁富椤�
- UserView.UserPage.Instance.Fresh();
+ UserView.UserPage.Instance.ReFreshControl();
});
//鏂囦欢鎭㈠鎴愬姛
@@ -328,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)
{
//鍒涘缓澶囦唤鍚嶅瓧澶辫触
@@ -342,7 +341,7 @@
}
//涓婁紶鏁版嵁鍒颁簯绔�
- bool result = await HdlBackupLogic.Current.UpLoadBackupFileToDB(backupClassId);
+ bool result = HdlBackupLogic.Current.UpLoadBackupFileToDB(backupClassId);
if (result == false)
{
//鏂囦欢涓婁紶澶辫触
@@ -372,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)
{
//鏂囦欢涓婁紶澶辫触
@@ -403,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
@@ -441,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)
@@ -484,9 +473,9 @@
var dialogForm = new DialogInputControl();
//缂栬緫澶囦唤
dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorBackup));
- //璇疯緭鍏ュ娉ㄥ悕绉�
- dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup));
- dialogForm.Text = fileInfo.BackupName;
+ //璇疯緭鍏ュ浠藉悕绉�
+ dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName));
+ dialogForm.Text = fileInfo.FolderName;
//鎸変笅纭鎸夐挳
dialogForm.ComfirmClickEvent += ((textValue) =>
@@ -501,7 +490,7 @@
dialogForm.CloseDialog();
//鍚嶅瓧涓�鏍锋椂锛屼笉澶勭悊
- if (textValue != fileInfo.BackupName)
+ if (textValue != fileInfo.FolderName)
{
//缂栬緫澶囦唤鍚嶇О
this.EditorBackInfo(fileInfo.Id, textValue);
@@ -519,8 +508,8 @@
var dialogForm = new DialogInputControl();
//娣诲姞澶囦唤
dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddBackup));
- //璇疯緭鍏ュ娉ㄥ悕绉�
- dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup));
+ //璇疯緭鍏ュ浠藉悕绉�
+ dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName));
//鎸変笅纭鎸夐挳
dialogForm.ComfirmClickEvent += ((textValue) =>
@@ -544,28 +533,6 @@
#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>
/// 妫�娴嬪鑰冨悕绉�
/// </summary>
/// <param name="backName"></param>
@@ -574,8 +541,8 @@
{
if (backName == string.Empty)
{
- //璇疯緭鍏ュ娉ㄥ悕绉�
- string msg = Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup);
+ //璇疯緭鍏ュ浠藉悕绉�
+ string msg = Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName);
this.ShowMassage(ShowMsgType.Error, msg);
return false;
}
--
Gitblit v1.8.0