From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 10 七月 2020 10:52:13 +0800
Subject: [PATCH] 2020-07-10-01

---
 ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayUploadAndDownLoadForm.cs |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayUploadAndDownLoadForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayUploadAndDownLoadForm.cs
index 3688714..a33c6f0 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;
+                }
             };
 
             //涓婁紶鏁版嵁鑷充簯绔�
@@ -88,17 +92,16 @@
                     return;
                 }
                 //鐢熸垚涓�涓脊绐楃敾闈�
-                var dialogForm = new DialogInputForm();
-                dialogForm.AddForm(DialogFrameMode.OnlyInput);
+                var dialogForm = new DialogInputControl();
                 //涓婁紶鏁版嵁
                 dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uUploadData));
-                //璇疯緭鍏ュ娉ㄥ悕绉�
-                dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup));
+                //璇疯緭鍏ュ浠藉悕绉�
+                dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName));
                 //鎸変笅纭鎸夐挳
                 dialogForm.ComfirmClickEvent += ((textValue) =>
                 {
                     //鐢婚潰鍏抽棴
-                    dialogForm.CloseForm();
+                    dialogForm.CloseDialog();
                     HdlThreadLogic.Current.RunThread(() =>
                     {
                         //涓婁紶澶囦唤
@@ -114,16 +117,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