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/Gateway/Manage/GatewayBackUpListForm.cs |  202 ++++++++++++++++++++++---------------------------
 1 files changed, 91 insertions(+), 111 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs
index 505b884..b43b043 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs
@@ -90,86 +90,81 @@
             this.nowSelectBackId = string.Empty;
             this.nowbtnSelect = null;
 
-            //鈽嗐優銉笺偗鈽�
-            ////杩涘害鏉�
-            //this.ShowProgressBar();
+            //杩涘害鏉�
+            this.ShowProgressBar();
 
-            ////鑾峰彇鑷姩澶囦唤鐨勬暟鎹�
-            //var pageAuto = HdlBackupLogic.Current.GetBackupListNameFromDB(3, realGateway.GwId);
-            //if (pageAuto == null)
-            //{
-            //    //鍏抽棴杩涘害鏉�
-            //    this.CloseProgressBar(ShowReLoadMode.YES);
-            //    return;
-            //}
+            //鑾峰彇鑷姩澶囦唤鐨勬暟鎹�
+            var listAutoData = HdlGatewayBackupLogic.Current.GetGatewayBackupListFromDb(realGateway.GwId, BackUpMode.A鑷姩澶囦唤);
+            if (listAutoData == null)
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar(ShowReLoadMode.YES);
+                return;
+            }
 
-            ////浠庝簯绔幏鍙栨暟鎹� 
-            //var pageData = HdlBackupLogic.Current.GetBackupListNameFromDB(2, realGateway.GwId);
-            //if (pageData == null)
-            //{
-            //    //鍏抽棴杩涘害鏉�
-            //    this.CloseProgressBar(ShowReLoadMode.YES);
-            //    return;
-            //}
-            ////鍏抽棴杩涘害鏉�
-            //this.CloseProgressBar();
+            //浠庝簯绔幏鍙栨墜鍔ㄥ浠芥暟鎹� 
+            var listHandData = HdlGatewayBackupLogic.Current.GetGatewayBackupListFromDb(realGateway.GwId, BackUpMode.A鎵嬪姩澶囦唤);
+            if (listHandData == null)
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar(ShowReLoadMode.YES);
+                return;
+            }
+            //鍏抽棴杩涘害鏉�
+            this.CloseProgressBar();
 
-            //HdlThreadLogic.Current.RunMain(() =>
-            //{
-            //    listView.RemoveAll();
-            //    listView.RecoverHeight();
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                listView.RemoveAll();
+                listView.RecoverHeight();
+                if (listAutoData.Count > 0)
+                {
+                    //娣诲姞鑷姩澶囦唤琛�
+                    this.AddRowlayout(listAutoData[0], listAutoData.Count > 0, true);
+                }
 
-            //    //鑷姩澶囦唤鐨処D
-            //    string autoID = string.Empty;
-            //    if (pageAuto.Count > 0)
-            //    {
-            //        autoID = pageAuto[0].Id;
-            //        //娣诲姞鑷姩澶囦唤琛�
-            //        this.AddRowlayout(pageAuto[0], pageData.Count > 0, true);
-            //    }
+                for (int i = 0; i < listHandData.Count; i++)
+                {
+                    //娣诲姞澶囦唤琛�
+                    this.AddRowlayout(listHandData[i], i != listHandData.Count - 1, false);
+                }
 
-            //    for (int i = 0; i < pageData.Count; i++)
-            //    {
-            //        //娣诲姞澶囦唤琛�
-            //        this.AddRowlayout(pageData[i], i != pageData.Count - 1, false);
-            //    }
-
-            //    this.btnDownload?.RemoveFromParent();
-            //    if (pageData.Count > 0 || pageAuto.Count > 0)
-            //    {
-            //        //涓嬭浇
-            //        this.btnDownload = new BottomClickButton();
-            //        btnDownload.TextID = R.MyInternationalizationString.uDownLoad;
-            //        bodyFrameLayout.AddChidren(btnDownload);
-            //        btnDownload.ButtonClickEvent += (sender, e) =>
-            //        {
-            //            if (this.nowSelectBackId == string.Empty)
-            //            {
-            //                return;
-            //            }
-            //            //鏄惁瑕佷笅杞藉苟鎭㈠鏁版嵁锛�
-            //            string msg = Language.StringByID(R.MyInternationalizationString.uDownLoadAndRecoverMsg);
-            //            this.ShowMassage(ShowMsgType.Confirm, msg, () =>
-            //             {
-            //                 HdlThreadLogic.Current.RunThread(() =>
-            //                 {
-            //                     //璇诲彇澶囦唤鏂囨。
-            //                     bool result = HdlGatewayBackupLogic.Current.RecoverGateway(this.realGateway, this.nowSelectBackId, autoID == this.nowSelectBackId ? 1 : 0);
-            //                     if (result == true)
-            //                     {
-            //                         HdlThreadLogic.Current.RunMain(() =>
-            //                         {
-            //                             //鍏抽棴杩欎釜鐣岄潰
-            //                             this.CloseForm();
-            //                         });
-            //                     }
-            //                 });
-            //             });
-            //        };
-            //        //璋冩暣鐪熷疄楂樺害
-            //        listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(23));
-            //    }
-            //});
+                this.btnDownload?.RemoveFromParent();
+                if (listAutoData.Count > 0 || listHandData.Count > 0)
+                {
+                    //涓嬭浇
+                    this.btnDownload = new BottomClickButton();
+                    btnDownload.TextID = R.MyInternationalizationString.uDownLoad;
+                    bodyFrameLayout.AddChidren(btnDownload);
+                    btnDownload.ButtonClickEvent += (sender, e) =>
+                    {
+                        if (this.nowSelectBackId == string.Empty)
+                        {
+                            return;
+                        }
+                        //鏄惁瑕佷笅杞藉苟鎭㈠鏁版嵁锛�
+                        string msg = Language.StringByID(R.MyInternationalizationString.uDownLoadAndRecoverMsg);
+                        this.ShowMassage(ShowMsgType.Confirm, msg, () =>
+                         {
+                             HdlThreadLogic.Current.RunThread(() =>
+                             {
+                                 //璇诲彇澶囦唤鏂囨。
+                                 bool result = HdlGatewayBackupLogic.Current.RecoverGateway(this.realGateway.GwId, this.nowSelectBackId);
+                                 if (result == true)
+                                 {
+                                     HdlThreadLogic.Current.RunMain(() =>
+                                     {
+                                         //鍏抽棴杩欎釜鐣岄潰
+                                         this.CloseForm();
+                                     });
+                                 }
+                             });
+                         });
+                    };
+                    //璋冩暣鐪熷疄楂樺害
+                    listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(23));
+                }
+            });
         }
 
         #endregion
@@ -194,9 +189,9 @@
                 txtText.TextID = R.MyInternationalizationString.uAutoBackup;
             }
 
-            //鏃堕棿 2019-11-11T11:31:01
+            //鏃堕棿
             var btnTime = rowLayout.frameTable.AddBottomView("", 600);
-            if (fileInfo.ModifyTime.Length >= 13)
+            if (fileInfo.ModifyTime.Length == 13)
             {
                 btnTime.Text = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(fileInfo.ModifyTime).ToString("yyyy.MM.dd HH:mm:ss");
             }
@@ -262,28 +257,21 @@
         /// <summary>
         /// 缂栬緫澶囦唤鍚嶇О
         /// </summary>
-        /// <param name="BackupClassId"></param>
+        /// <param name="backupClassId"></param>
         /// <param name="backName"></param>
-        private void EditorBackInfo(string BackupClassId, string backName)
+        private void EditorBackInfo(string backupClassId, string backName)
         {
-            //鈽嗐優銉笺偗鈽�
-            //var Pra = new EditorBackUpNamePra();
-            //Pra.BackupClassId = BackupClassId;
-            //Pra.BackupName = backName;
-            ////鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken
-            //Pra.LoginAccessToken = HdlUserCenterLogic.GetConnectMainToken();
+            var result = HdlGatewayBackupLogic.Current.EditorGatewayBackupName(backupClassId, backName);
+            if (result == false)
+            {
+                return;
+            }
 
-            //bool result = HdlUserCenterLogic.GetResultStatuByRequestHttps("App/UpdateHomeAppGatewayName", true, Pra);
-            //if (result == false)
-            //{
-            //    return;
-            //}
-
-            //HdlThreadLogic.Current.RunThread(() =>
-            //{
-            //    //浠庝簯绔幏鍙栨暟鎹�
-            //    this.SetBackupInfoToForm();
-            //});
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //浠庝簯绔幏鍙栨暟鎹�
+                this.SetBackupInfoToForm();
+            });
         }
 
         #endregion
@@ -293,15 +281,15 @@
         /// <summary>
         /// 鍒犻櫎澶囦唤鏂囨。
         /// </summary>
-        /// <param name="BackupClassId"></param>
-        private void DeleteBackInfo(string BackupClassId)
+        /// <param name="backupClassId"></param>
+        private void DeleteBackInfo(string backupClassId)
         {
-            bool success = HdlBackupLogic.Current.DeleteDbBackupData(BackupClassId);
+            bool success = HdlGatewayBackupLogic.Current.DeleteGatewayBackup(this.realGateway.GwId, backupClassId);
             if (success == false)
             {
                 return;
             }
-            if (this.nowSelectBackId == BackupClassId)
+            if (this.nowSelectBackId == backupClassId)
             {
                 this.nowSelectBackId = string.Empty;
                 this.nowbtnSelect = null;
@@ -325,19 +313,11 @@
         private void ShowEditorBackupForm(BackupListNameInfo fileInfo)
         {
             //鐢熸垚涓�涓脊绐楃敾闈�
-            var dialogForm = new DialogInputControl();
-
-            //缂栬緫澶囦唤
-            dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorBackup));
-            //璇疯緭鍏ュ浠藉悕绉�
-            dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName));
-            dialogForm.Text = fileInfo.FolderName;
-
-            //鎸変笅纭鎸夐挳
-            dialogForm.ComfirmClickEvent += ((txtvalue) =>
+            this.ShowDialogInputForm(Language.StringByID(R.MyInternationalizationString.uEditorBackup), fileInfo.FolderName,
+                Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName), (contr, txtvalue) =>
             {
                 //鐢婚潰鍏抽棴
-                dialogForm.CloseDialog();
+                contr.CloseDialog();
                 //鍚嶅瓧涓�鏍锋椂锛屼笉澶勭悊
                 if (txtvalue != fileInfo.FolderName)
                 {

--
Gitblit v1.8.0