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/GatewayUploadAndDownLoadForm.cs |   65 ++++++++++++++++++++++++++------
 1 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayUploadAndDownLoadForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayUploadAndDownLoadForm.cs
index 3688714..4a3bdfb 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayUploadAndDownLoadForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayUploadAndDownLoadForm.cs
@@ -69,7 +69,11 @@
             var btnSwicth = frameAuto.AddMostRightSwitchIcon();
             btnSwicth.ButtonClickEvent += (sender, e) =>
             {
-                btnSwicth.IsSelected = !btnSwicth.IsSelected;
+                //璁剧疆鐘舵��
+                if (HdlGatewayLogic.Current.SetGatewayAutoBackupStatu(this.realGateway, !btnSwicth.IsSelected) == true)
+                {
+                    btnSwicth.IsSelected = !btnSwicth.IsSelected;
+                }
             };
 
             //涓婁紶鏁版嵁鑷充簯绔�
@@ -87,22 +91,17 @@
                     this.ShowMassage(ShowMsgType.Error, msg);
                     return;
                 }
+
                 //鐢熸垚涓�涓脊绐楃敾闈�
-                var dialogForm = new DialogInputForm();
-                dialogForm.AddForm(DialogFrameMode.OnlyInput);
-                //涓婁紶鏁版嵁
-                dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uUploadData));
-                //璇疯緭鍏ュ娉ㄥ悕绉�
-                dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup));
-                //鎸変笅纭鎸夐挳
-                dialogForm.ComfirmClickEvent += ((textValue) =>
+                this.ShowDialogInputForm(Language.StringByID(R.MyInternationalizationString.uUploadData),
+                    Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName), null, (contr, textValue) =>
                 {
                     //鐢婚潰鍏抽棴
-                    dialogForm.CloseForm();
+                    contr.CloseDialog();
                     HdlThreadLogic.Current.RunThread(() =>
                     {
                         //涓婁紶澶囦唤
-                        HdlGatewayBackupLogic.Current.DoBackupGateway(this.realGateway, textValue);
+                        HdlGatewayBackupLogic.Current.DoBackupGateway(this.realGateway.GwId, textValue);
                     });
                 });
             };
@@ -114,16 +113,58 @@
             frameDown.AddRightArrow();
             frameDown.ButtonClickEvent += (sender, e) =>
             {
+                if (this.realGateway == null)
+                {
+                    //閿欒:缃戝叧瀵硅薄涓㈠け
+                    string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
+                    this.ShowMassage(ShowMsgType.Error, msg);
+                    return;
+                }
                 var form = new GatewayBackUpListForm();
                 form.AddForm(this.realGateway);
             };
             //璋冩暣鐪熷疄楂樺害
             listView.AdjustRealHeight(Application.GetRealHeight(23));
+
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //鑾峰彇缃戝叧鏁版嵁
+                this.GetGatewayData(btnSwicth);
+            });
         }
 
         #endregion
 
-        #region 鈻� 涓�鑸柟娉昣__________________________
+        #region 鈻� 鑾峰彇鏁版嵁___________________________
+
+        /// <summary>
+        /// 鑾峰彇缃戝叧鏁版嵁
+        /// </summary>
+        /// <param name="btnSwitch"></param>
+        private void GetGatewayData(MostRightIconControl btnSwitch)
+        {
+            //鎵撳紑杩涘害鏉�
+            this.ShowProgressBar();
+
+            //鑾峰彇缃戝叧鑷姩璁剧疆鐘舵��
+            var statu = HdlGatewayLogic.Current.GetGatewayAutoBackupStatu(realGateway);
+            if (statu == -1)
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar(ShowReLoadMode.YES);
+                return;
+            }
+            if (statu == 1)
+            {
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    btnSwitch.IsSelected = true;
+                });
+            }
+
+            //鍏抽棴杩涘害鏉�
+            this.CloseProgressBar();
+        }
 
         #endregion
     }

--
Gitblit v1.8.0