From e90209beae6a4e822cecb18e6889f8bda23f630e Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 14 十二月 2020 11:16:06 +0800
Subject: [PATCH] 合并了晾衣架(非新云端)

---
 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs |  192 ++++++++++++++++++++++++-----------------------
 1 files changed, 97 insertions(+), 95 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs
index 505b884..3b83ece 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayBackUpListForm.cs
@@ -90,86 +90,89 @@
             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 pageAuto = HdlBackupLogic.Current.GetBackupListNameFromDB(3, realGateway.GwId);
+            if (pageAuto == 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 pageData = HdlBackupLogic.Current.GetBackupListNameFromDB(2, realGateway.GwId);
+            if (pageData == null)
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar(ShowReLoadMode.YES);
+                return;
+            }
+            //鍏抽棴杩涘害鏉�
+            this.CloseProgressBar();
 
-            //HdlThreadLogic.Current.RunMain(() =>
-            //{
-            //    listView.RemoveAll();
-            //    listView.RecoverHeight();
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                listView.RemoveAll();
+                listView.RecoverHeight();
 
-            //    //鑷姩澶囦唤鐨処D
-            //    string autoID = string.Empty;
-            //    if (pageAuto.Count > 0)
-            //    {
-            //        autoID = pageAuto[0].Id;
-            //        //娣诲姞鑷姩澶囦唤琛�
-            //        this.AddRowlayout(pageAuto[0], pageData.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 < pageData.Count; i++)
-            //    {
-            //        //娣诲姞澶囦唤琛�
-            //        this.AddRowlayout(pageData[i], i != pageData.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 (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)
+                                 {
+                                     //缃戝叧鏁版嵁鎭㈠鎴愬姛!
+                                     msg = Language.StringByID(R.MyInternationalizationString.uRestoreGatewayDataSuccess);
+                                     this.ShowMassage(ShowMsgType.Tip, msg);
+
+                                     HdlThreadLogic.Current.RunMain(() =>
+                                     {
+                                         //鍏抽棴杩欎釜鐣岄潰
+                                         this.CloseForm();
+                                     });
+                                 }
+                             });
+                         });
+                    };
+                    //璋冩暣鐪熷疄楂樺害
+                    listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(23));
+                }
+            });
         }
 
         #endregion
@@ -188,7 +191,7 @@
             listView.AddChidren(rowLayout);
 
             //澶囦唤鍚嶅瓧
-            var txtText = rowLayout.frameTable.AddTopView(fileInfo.FolderName, 700);
+            var txtText = rowLayout.frameTable.AddTopView(fileInfo.BackupName, 700);
             if (isAuto == true)
             {
                 txtText.TextID = R.MyInternationalizationString.uAutoBackup;
@@ -196,9 +199,9 @@
 
             //鏃堕棿 2019-11-11T11:31:01
             var btnTime = rowLayout.frameTable.AddBottomView("", 600);
-            if (fileInfo.ModifyTime.Length >= 13)
+            if (fileInfo.CreatedOnUtc.Length >= 19)
             {
-                btnTime.Text = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(fileInfo.ModifyTime).ToString("yyyy.MM.dd HH:mm:ss");
+                btnTime.Text = UserCenterLogic.ConvertUtcTimeToLocalTime(fileInfo.CreatedOnUtc).ToString("yyyy.MM.dd HH:mm:ss");
             }
             //搴曠嚎
             if (addLine == true)
@@ -266,24 +269,23 @@
         /// <param name="backName"></param>
         private void EditorBackInfo(string BackupClassId, string backName)
         {
-            //鈽嗐優銉笺偗鈽�
-            //var Pra = new EditorBackUpNamePra();
-            //Pra.BackupClassId = BackupClassId;
-            //Pra.BackupName = backName;
-            ////鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken
-            //Pra.LoginAccessToken = HdlUserCenterLogic.GetConnectMainToken();
+            var Pra = new EditorBackUpNamePra();
+            Pra.BackupClassId = BackupClassId;
+            Pra.BackupName = backName;
+            //鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken
+            Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
 
-            //bool result = HdlUserCenterLogic.GetResultStatuByRequestHttps("App/UpdateHomeAppGatewayName", true, Pra);
-            //if (result == false)
-            //{
-            //    return;
-            //}
+            bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/UpdateHomeAppGatewayName", true, Pra);
+            if (result == false)
+            {
+                return;
+            }
 
-            //HdlThreadLogic.Current.RunThread(() =>
-            //{
-            //    //浠庝簯绔幏鍙栨暟鎹�
-            //    this.SetBackupInfoToForm();
-            //});
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //浠庝簯绔幏鍙栨暟鎹�
+                this.SetBackupInfoToForm();
+            });
         }
 
         #endregion
@@ -331,7 +333,7 @@
             dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorBackup));
             //璇疯緭鍏ュ浠藉悕绉�
             dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName));
-            dialogForm.Text = fileInfo.FolderName;
+            dialogForm.Text = fileInfo.BackupName;
 
             //鎸変笅纭鎸夐挳
             dialogForm.ComfirmClickEvent += ((txtvalue) =>
@@ -339,7 +341,7 @@
                 //鐢婚潰鍏抽棴
                 dialogForm.CloseDialog();
                 //鍚嶅瓧涓�鏍锋椂锛屼笉澶勭悊
-                if (txtvalue != fileInfo.FolderName)
+                if (txtvalue != fileInfo.BackupName)
                 {
                     //缂栬緫澶囦唤鍚嶇О
                     this.EditorBackInfo(fileInfo.Id, txtvalue);

--
Gitblit v1.8.0