From 404cdc88627f942df7944af04ee05b9d527752d6 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 30 九月 2019 13:22:40 +0800
Subject: [PATCH] 合并了徐梅的按键面板绑定

---
 ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlGatewayBackUpForm.cs |  992 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 502 insertions(+), 490 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlGatewayBackUpForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlGatewayBackUpForm.cs
index cfea6c7..2251c8d 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlGatewayBackUpForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/HdlBackup/HdlGatewayBackUpForm.cs
@@ -10,7 +10,7 @@
     /// <summary>
     /// 缃戝叧澶囦唤鐨勭晫闈�
     /// </summary>
-    public class HdlGatewayBackUpForm : UserCenterCommonForm
+    public class HdlGatewayBackUpForm : EditorCommonForm
     {
         #region 鈻� 鍙橀噺澹版槑___________________________
 
@@ -30,564 +30,576 @@
         /// <summary>
         /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
         /// </summary>
-        /// <param name="i_zbGateway"></param>
-        public void ShowForm(ZbGateway i_zbGateway)
-        {
-            this.zbRealGateway = i_zbGateway;
-
-            //璁剧疆鏍囬淇℃伅
+        /// <param name="i_zbGateway"></param>
+        public void ShowForm(ZbGateway i_zbGateway)
+        {
+            this.zbRealGateway = i_zbGateway;
+
+            //璁剧疆鏍囬淇℃伅
             base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uBackupAndRecover));
 
             //鍙充笂娣诲姞鎸夐挳
-            var btnTopIcon = new TopLayoutMostRightView();
+            var btnTopIcon = new MostRightIconControl(69, 69);
             btnTopIcon.UnSelectedImagePath = "Item/Add.png";
-            btnTopIcon.SelectedImagePath = "Item/AddSelected.png";
-            topFrameLayout.AddChidren(btnTopIcon);
-            btnTopIcon.MouseUpEventHandler += (sender, e) =>
+            topFrameLayout.AddChidren(btnTopIcon);
+            btnTopIcon.InitControl();
+            btnTopIcon.ButtonClickEvent += (sender, e) =>
             {
                 //鏄剧ず娣诲姞澶囪�冨悕鐢婚潰
-                this.ShowAddBackupForm();
-            };
-
-            //鍒濆鍖栦腑閮ㄦ帶浠�
-            this.InitMiddleFrame();
-        }
-
-        /// <summary>
-        /// 鍒濆鍖栦腑閮ㄦ帶浠�
-        /// </summary>
-        private void InitMiddleFrame()
-        {
-            listView = new VerticalScrolViewLayout();
-            listView.Height = bodyFrameLayout.Height;
-            bodyFrameLayout.AddChidren(listView);
-
-            new System.Threading.Thread(() =>
-            {
-                //浠庝簯绔幏鍙栨暟鎹�
-                this.SetBackupInfoToForm();
-            })
-            { IsBackground = true }.Start();
-        }
-
-        #endregion
-
-        #region 鈻� 浠庝簯绔幏鍙栨暟鎹甠____________________
-
-        /// <summary>
-        /// 浠庝簯绔幏鍙栨暟鎹�
-        /// </summary>
-        private async void SetBackupInfoToForm()
-        {
-            //杩涘害鏉�
-            this.ShowProgressBar();
-
-            //浠庝簯绔幏鍙栨暟鎹� 
-            var pageData = await HdlBackupLogic.Current.GetBackupListNameFromDB(2, Common.LocalGateway.Current.GetGatewayId(zbRealGateway));
-            //鍏抽棴
-            this.CloseProgressBar();
-
-            if (pageData == null)
-            {
-                return;
-            }
-
-            Application.RunOnMainThread(() =>
-            {
-                listView.RemoveAll();
-            });
-
-            foreach (BackupListNameInfo fileInfo in pageData)
-            {
-                Application.RunOnMainThread(() =>
-                {
-                    //娣诲姞澶囦唤琛�
-                    this.AddRowlayout(fileInfo);
-                });
-            }
-        }
-
-        #endregion
-
-        #region 鈻� 娣诲姞澶囦唤琛宊________________________
-
-        /// <summary>
-        /// 娣诲姞澶囦唤琛�
-        /// </summary>
-        /// <param name="fileInfo"></param>
-        private void AddRowlayout(BackupListNameInfo fileInfo)
-        {
-            //琛�
-            var rowLayout = new StatuRowLayout(listView);
-            //鍥炬爣
-            var btnPoint = new RowLeftIconView();
-            btnPoint.SelectedImagePath = "Center/BackupSelected.png";
-            btnPoint.UnSelectedImagePath = "Center/Backup.png";
-            rowLayout.AddChidren(btnPoint);
-
-            //澶囦唤鍚嶅瓧
-            var txtText = new RowCenterView();
-            txtText.Text = fileInfo.BackupName;
-            rowLayout.AddChidren(txtText);
-            txtText.X -= ControlCommonResourse.PointXXLeft;
-
-            //缂栬緫澶囨敞鍚�
-            rowLayout.MouseUpEvent += (sender, e) =>
-            {
-                //鏄剧ず缂栬緫澶囪�冨悕鐢婚潰
-                this.ShowEditorBackupForm(fileInfo);
+                //this.ShowAddBackupForm();
             };
 
-            //涓嬭浇鍥炬爣
-            var btnLoad = new MostRightEmptyView();
-            //鍚敤鐐逛寒鍔熻兘
-            btnLoad.UseClickStatu = true;
-            btnLoad.UnSelectedImagePath = "Item/DownLoad.png";
-            btnLoad.SelectedImagePath = "Item/DownLoadSelected.png";
-            rowLayout.AddChidren(btnLoad, ChidrenBindMode.NotBind);
-            //涓嬭浇鍥炬爣澶彸杈逛笉濂界湅 
-            btnLoad.X -= Application.GetRealWidth(50);
-            btnLoad.MouseUpEventHandler += (sender, e) =>
-            {
-                //鏄惁瑕佷笅杞藉苟鎭㈠鏁版嵁锛�
-                string msg = Language.StringByID(R.MyInternationalizationString.uDownLoadAndRecoverMsg);
-                this.ShowConfirmMsg(msg, "LoadBackupInfo", fileInfo.Id);
-            };
-
-            //鍒犻櫎
-            var btnDelete = new RowDeleteButton();
-            rowLayout.AddRightView(btnDelete);
-            btnDelete.MouseUpEventHandler += (sender, e) =>
-            {
-                //纭畾瑕佸垹闄ゆ枃浠跺悧锛�
-                string msg = Language.StringByID(R.MyInternationalizationString.uDoDeleteFileMsg);
-                this.ShowConfirmMsg(msg, "DeleteBackInfo", fileInfo.Id, ShowErrorMode.YES);
-            };
+            //鍒濆鍖栦腑閮ㄦ帶浠�
+            //this.InitMiddleFrame();
         }
+
+        ///// <summary>
+        ///// 鍒濆鍖栦腑閮ㄦ帶浠�
+        ///// </summary>
+        //private void InitMiddleFrame()
+        //{
+        //    //娓呯┖bodyFrame
+        //    this.ClearBodyFrame();
+
+        //    listView = new VerticalScrolViewLayout();
+        //    listView.Height = bodyFrameLayout.Height;
+        //    bodyFrameLayout.AddChidren(listView);
+
+        //    new System.Threading.Thread(() =>
+        //    {
+        //        //浠庝簯绔幏鍙栨暟鎹�
+        //        this.SetBackupInfoToForm();
+        //    })
+        //    { IsBackground = true }.Start();
+        //}
 
         #endregion
 
-        #region 鈻� 璇诲彇澶囦唤鏂囨。_______________________
+        //#region 鈻� 浠庝簯绔幏鍙栨暟鎹甠____________________
 
-        /// <summary>
-        /// 璇诲彇澶囦唤鏂囨。
-        /// </summary>
-        /// <param name="BackupClassId"></param>
-        public void LoadBackupInfo(string BackupClassId)
-        {
-            new System.Threading.Thread(async () =>
-            {
-                //鑾峰彇缃戝叧涓婇潰瀛樺湪鐨勫叏閮ㄦ枃浠�
-                var listFile = await this.GetGatewayFileFromGateway();
-                if (listFile == null)
-                {
-                    return;
-                }
-                //浠庝簯绔幏鍙栧浠界殑鏂囦欢
-                bool result = await HdlBackupLogic.Current.LoadGatewayBackupInfo(BackupClassId, zbRealGateway, listFile);
-                if (result == false)
-                {
-                    //缃戝叧鎭㈠澶辫触
-                    string msg2 = Language.StringByID(R.MyInternationalizationString.uGatewayFileRecoverFail);
-                    this.ShowNormalMsg(msg2);
-                    return;
-                }
+        ///// <summary>
+        ///// 浠庝簯绔幏鍙栨暟鎹�
+        ///// </summary>
+        //private async void SetBackupInfoToForm()
+        //{
+        //    //杩涘害鏉�
+        //    this.ShowProgressBar();
 
-                Application.RunOnMainThread(() =>
-                {
-                    //鍏抽棴鑷韩
-                    this.CloseForm();
-                });
+        //    //浠庝簯绔幏鍙栨暟鎹� 
+        //    var pageData = await HdlBackupLogic.Current.GetBackupListNameFromDB(2, Common.LocalGateway.Current.GetGatewayId(zbRealGateway));
+        //    //鍏抽棴
+        //    this.CloseProgressBar();
 
-                //缃戝叧鎭㈠鎴愬姛
-                string msg = Language.StringByID(R.MyInternationalizationString.uGatewayFileRecoverSuccess);
-                this.ShowNormalMsg(msg);
-            })
-            { IsBackground = true }.Start();
-        }
+        //    if (pageData == null)
+        //    {
+        //        return;
+        //    }
 
-        #endregion
+        //    Application.RunOnMainThread(() =>
+        //    {
+        //        if (listView != null)
+        //        {
+        //            listView.RemoveAll();
+        //        }
+        //    });
 
-        #region 鈻� 涓婁紶鏁版嵁___________________________
+        //    foreach (BackupListNameInfo fileInfo in pageData)
+        //    {
+        //        Application.RunOnMainThread(() =>
+        //        {
+        //            if (this.Parent != null)
+        //            {
+        //                //娣诲姞澶囦唤琛�
+        //                this.AddRowlayout(fileInfo);
+        //            }
+        //        });
+        //    }
+        //}
 
-        /// <summary>
-        /// 涓婁紶鏁版嵁
-        /// </summary>
-        /// <param name="backName"></param>
-        private async void UpLoadBackInfo(string backName)
-        {
-            //灞曞紑杩涘害鏉�
-            this.ShowProgressBar();
+        //#endregion
 
-            //鍒涘缓涓�涓浠藉悕瀛�
-            string backupClassId = await HdlBackupLogic.Current.CreatNewBackupNameToDB(backName, 2, Common.LocalGateway.Current.GetGatewayId(zbRealGateway));
-            if (backupClassId == null)
-            {
-                //鍒涘缓澶囦唤鍚嶅瓧澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uCreatBackupNameFail);
-                this.ShowErrorMsg(msg);
+        //#region 鈻� 娣诲姞澶囦唤琛宊________________________
 
-                //鍏抽棴杩涘害鏉�
-                this.CloseProgressBar();
-                return;
-            }
-            //娣诲姞闄勫姞鎯呮姤:鑾峰彇缃戝叧鏁版嵁
-            string appendText = Language.StringByID(R.MyInternationalizationString.uGetGatewayData);
-            ProgressBar.SetAppendText(appendText);
+        ///// <summary>
+        ///// 娣诲姞澶囦唤琛�
+        ///// </summary>
+        ///// <param name="fileInfo"></param>
+        //private void AddRowlayout(BackupListNameInfo fileInfo)
+        //{
+        //    //琛�
+        //    var rowLayout = new StatuRowLayout(listView);
+        //    //鍥炬爣
+        //    var btnPoint = new RowLeftIconView();
+        //    btnPoint.SelectedImagePath = "Center/BackupSelected.png";
+        //    btnPoint.UnSelectedImagePath = "Center/Backup.png";
+        //    rowLayout.AddChidren(btnPoint);
 
-            //杩欓噷鏄粠缃戝叧鑾峰彇澶囦唤鏂囦欢:灏嗙綉鍏虫枃浠跺瓨鍏ュ埌鎸囧畾鐨勮矾寰勪笅
-            string directory = await this.SetGatewayFileInDirectory();
-            //鍏抽棴杩涘害鏉�
-            this.CloseProgressBar();
-            if (directory == null)
-            {
-                //濡傛灉涓婁紶澶辫触鐨勮瘽锛屽氨鎶婂畠鍒犻櫎
-                this.DeleteBackInfo(backupClassId, ShowErrorMode.NO);
-                return;
-            }
+        //    //澶囦唤鍚嶅瓧
+        //    var txtText = new RowCenterView();
+        //    txtText.Text = fileInfo.BackupName;
+        //    rowLayout.AddChidren(txtText);
+        //    txtText.X -= ControlCommonResourse.PointXXLeft;
 
-            //娣诲姞闄勫姞鎯呮姤:涓婁紶鏁版嵁
-            appendText = Language.StringByID(R.MyInternationalizationString.uDataUpLoad);
-            ProgressBar.SetAppendText(appendText);
+        //    //缂栬緫澶囨敞鍚�
+        //    rowLayout.MouseUpEvent += (sender, e) =>
+        //    {
+        //        //鏄剧ず缂栬緫澶囪�冨悕鐢婚潰
+        //        this.ShowEditorBackupForm(fileInfo);
+        //    };
 
-            new System.Threading.Thread(async () =>
-            {
-                //涓婁紶鏁版嵁鍒颁簯绔�
-                directory = UserCenterLogic.CombinePath(directory);
-                bool result = await HdlBackupLogic.Current.UpLoadBackupFileToDB(backupClassId, 2, directory);
-                //娓呯┖闄勫姞鎯呮姤
-                ProgressBar.SetAppendText(string.Empty);
+        //    //涓嬭浇鍥炬爣
+        //    var btnLoad = new MostRightEmptyView();
+        //    //鍚敤鐐逛寒鍔熻兘
+        //    btnLoad.UseClickStatu = true;
+        //    btnLoad.UnSelectedImagePath = "Item/DownLoad.png";
+        //    btnLoad.SelectedImagePath = "Item/DownLoadSelected.png";
+        //    rowLayout.AddChidren(btnLoad, ChidrenBindMode.NotBind);
+        //    //涓嬭浇鍥炬爣澶彸杈逛笉濂界湅 
+        //    btnLoad.X -= Application.GetRealWidth(50);
+        //    btnLoad.MouseUpEventHandler += (sender, e) =>
+        //    {
+        //        //鏄惁瑕佷笅杞藉苟鎭㈠鏁版嵁锛�
+        //        string msg = Language.StringByID(R.MyInternationalizationString.uDownLoadAndRecoverMsg);
+        //        this.ShowConfirmMsg(msg, "LoadBackupInfo", fileInfo.Id);
+        //    };
 
-                if (result == false)
-                {
-                    //鏂囦欢涓婁紶澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uFileUpLoadFail);
-                    this.ShowErrorMsg(msg);
+        //    //鍒犻櫎
+        //    var btnDelete = new RowDeleteButton();
+        //    rowLayout.AddRightView(btnDelete);
+        //    btnDelete.MouseUpEventHandler += (sender, e) =>
+        //    {
+        //        //纭畾瑕佸垹闄ゆ枃浠跺悧锛�
+        //        string msg = Language.StringByID(R.MyInternationalizationString.uDoDeleteFileMsg);
+        //        this.ShowConfirmMsg(msg, "DeleteBackInfo", fileInfo.Id, ShowErrorMode.YES);
+        //    };
+        //}
 
-                    //濡傛灉涓婁紶澶辫触鐨勮瘽锛屽氨鎶婂畠鍒犻櫎
-                    this.DeleteBackInfo(backupClassId, ShowErrorMode.NO);
+        //#endregion
 
-                    return;
-                }
+        //#region 鈻� 璇诲彇澶囦唤鏂囨。_______________________
 
-                //鍒锋柊鐢婚潰
-                this.SetBackupInfoToForm();
-            })
-            { IsBackground = true }.Start();
-        }
+        ///// <summary>
+        ///// 璇诲彇澶囦唤鏂囨。
+        ///// </summary>
+        ///// <param name="BackupClassId"></param>
+        //public void LoadBackupInfo(string BackupClassId)
+        //{
+        //    new System.Threading.Thread(async () =>
+        //    {
+        //        //鑾峰彇缃戝叧涓婇潰瀛樺湪鐨勫叏閮ㄦ枃浠�
+        //        var listFile = await this.GetGatewayFileFromGateway();
+        //        if (listFile == null)
+        //        {
+        //            return;
+        //        }
+        //        //浠庝簯绔幏鍙栧浠界殑鏂囦欢
+        //        bool result = await HdlBackupLogic.Current.LoadGatewayBackupInfo(BackupClassId, zbRealGateway, listFile);
+        //        if (result == false)
+        //        {
+        //            //缃戝叧鎭㈠澶辫触
+        //            string msg2 = Language.StringByID(R.MyInternationalizationString.uGatewayFileRecoverFail);
+        //            this.ShowNormalMsg(msg2);
+        //            return;
+        //        }
 
-        #endregion
+        //        Application.RunOnMainThread(() =>
+        //        {
+        //            //鍏抽棴鑷韩
+        //            this.CloseForm();
+        //        });
 
-        #region 鈻� 缂栬緫澶囦唤鍚嶇О_______________________
+        //        //缃戝叧鎭㈠鎴愬姛
+        //        string msg = Language.StringByID(R.MyInternationalizationString.uGatewayFileRecoverSuccess);
+        //        this.ShowNormalMsg(msg);
+        //    })
+        //    { IsBackground = true }.Start();
+        //}
 
-        /// <summary>
-        /// 缂栬緫澶囦唤鍚嶇О
-        /// </summary>
-        /// <param name="BackupClassId"></param>
-        /// <param name="backName"></param>
-        private async void EditorBackInfo(string BackupClassId, string backName)
-        {
-            //寮�鍚繘搴︽潯
-            this.ShowProgressBar();
+        //#endregion
 
-            var Pra = new EditorBackUpNamePra();
-            Pra.BackupClassId = BackupClassId;
-            Pra.BackupName = backName;
+        //#region 鈻� 涓婁紶鏁版嵁___________________________
 
-            bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/UpdateHomeAppGatewayName", Pra);
-            if (result == false)
-            {
-                //缂栬緫澶囦唤鍚嶇О澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uEditorBackupNameFail);
-                this.ShowErrorMsg(msg);
-                //鍏抽棴杩涘害鏉�
-                this.CloseProgressBar();
-                return;
-            }
+        ///// <summary>
+        ///// 涓婁紶鏁版嵁
+        ///// </summary>
+        ///// <param name="backName"></param>
+        //private async void UpLoadBackInfo(string backName)
+        //{
+        //    //灞曞紑杩涘害鏉�
+        //    this.ShowProgressBar();
 
-            this.SetBackupInfoToForm();
-        }
+        //    //鍒涘缓涓�涓浠藉悕瀛�
+        //    string backupClassId = await HdlBackupLogic.Current.CreatNewBackupNameToDB(backName, 2, Common.LocalGateway.Current.GetGatewayId(zbRealGateway));
+        //    if (backupClassId == null)
+        //    {
+        //        //鍒涘缓澶囦唤鍚嶅瓧澶辫触
+        //        string msg = Language.StringByID(R.MyInternationalizationString.uCreatBackupNameFail);
+        //        this.ShowErrorMsg(msg);
 
-        #endregion
+        //        //鍏抽棴杩涘害鏉�
+        //        this.CloseProgressBar();
+        //        return;
+        //    }
+        //    //娣诲姞闄勫姞鎯呮姤:鑾峰彇缃戝叧鏁版嵁
+        //    string appendText = Language.StringByID(R.MyInternationalizationString.uGetGatewayData);
+        //    ProgressBar.SetAppendText(appendText);
 
-        #region 鈻� 鍒犻櫎澶囦唤鏂囨。_______________________
+        //    //杩欓噷鏄粠缃戝叧鑾峰彇澶囦唤鏂囦欢:灏嗙綉鍏虫枃浠跺瓨鍏ュ埌鎸囧畾鐨勮矾寰勪笅
+        //    string directory = await this.SetGatewayFileInDirectory();
+        //    //鍏抽棴杩涘害鏉�
+        //    this.CloseProgressBar();
+        //    if (directory == null)
+        //    {
+        //        //濡傛灉涓婁紶澶辫触鐨勮瘽锛屽氨鎶婂畠鍒犻櫎
+        //        this.DeleteBackInfo(backupClassId, ShowErrorMode.NO);
+        //        return;
+        //    }
 
-        /// <summary>
-        /// 鍒犻櫎澶囦唤鏂囨。
-        /// </summary>
-        /// <param name="BackupClassId"></param>
-        /// <param name="showMode"></param>
-        public async void DeleteBackInfo(string BackupClassId, ShowErrorMode showMode = ShowErrorMode.YES)
-        {
-            //杩涘害鏉�
-            this.ShowProgressBar();
+        //    //娣诲姞闄勫姞鎯呮姤:涓婁紶鏁版嵁
+        //    appendText = Language.StringByID(R.MyInternationalizationString.uDataUpLoad);
+        //    ProgressBar.SetAppendText(appendText);
 
-            bool success = await HdlBackupLogic.Current.DeleteDbBackupData(BackupClassId);
+        //    new System.Threading.Thread(async () =>
+        //    {
+        //        //涓婁紶鏁版嵁鍒颁簯绔�
+        //        directory = UserCenterLogic.CombinePath(directory);
+        //        bool result = await HdlBackupLogic.Current.UpLoadBackupFileToDB(backupClassId, 2, directory);
+        //        //娓呯┖闄勫姞鎯呮姤
+        //        ProgressBar.SetAppendText(string.Empty);
 
-            //鍏抽棴杩涘害鏉�
-            this.CloseProgressBar();
+        //        if (result == false)
+        //        {
+        //            //鏂囦欢涓婁紶澶辫触
+        //            string msg = Language.StringByID(R.MyInternationalizationString.uFileUpLoadFail);
+        //            this.ShowErrorMsg(msg);
 
-            if (success == false)
-            {
-                if (showMode == ShowErrorMode.YES)
-                {
-                    //鍒犻櫎澶囦唤澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBackupFail);
-                    this.ShowErrorMsg(msg);
-                }
-                return;
-            }
+        //            //濡傛灉涓婁紶澶辫触鐨勮瘽锛屽氨鎶婂畠鍒犻櫎
+        //            this.DeleteBackInfo(backupClassId, ShowErrorMode.NO);
 
-            this.SetBackupInfoToForm();
-        }
+        //            return;
+        //        }
 
-        #endregion
+        //        //鍒锋柊鐢婚潰
+        //        this.SetBackupInfoToForm();
+        //    })
+        //    { IsBackground = true }.Start();
+        //}
 
-        #region 鈻� 鏄剧ず缂栬緫澶囪�冨悕鐢婚潰_________________
+        //#endregion
 
-        /// <summary>
-        /// 鏄剧ず缂栬緫澶囪�冨悕鐢婚潰
-        /// </summary>
-        /// <param name="fileInfo"></param>
-        /// <returns></returns>
-        private void ShowEditorBackupForm(BackupListNameInfo fileInfo)
-        {
-            //鐢熸垚涓�涓脊绐楃敾闈�
-            var dialogForm = new DialogInputFrameControl(this, DialogFrameMode.OnlyInput);
+        //#region 鈻� 缂栬緫澶囦唤鍚嶇О_______________________
 
-            //缂栬緫澶囦唤
-            dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorBackup));
-            //璇疯緭鍏ュ娉ㄥ悕绉�
-            dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup));
-            dialogForm.InputText = fileInfo.BackupName;
+        ///// <summary>
+        ///// 缂栬緫澶囦唤鍚嶇О
+        ///// </summary>
+        ///// <param name="BackupClassId"></param>
+        ///// <param name="backName"></param>
+        //private async void EditorBackInfo(string BackupClassId, string backName)
+        //{
+        //    //寮�鍚繘搴︽潯
+        //    this.ShowProgressBar();
 
-            //鎸変笅纭鎸夐挳
-            dialogForm.ComfirmClickEvent += (() =>
-            {
-                string txtvalue = dialogForm.InputText;
-                //妫�娴嬪鑰冨悕绉�
-                if (this.CheckBackupName(txtvalue) == false)
-                {
-                    return;
-                }
+        //    var Pra = new EditorBackUpNamePra();
+        //    Pra.BackupClassId = BackupClassId;
+        //    Pra.BackupName = backName;
+        //    //鑾峰彇鎺у埗涓讳汉璐﹀彿鐨凾oken
+        //    Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
 
-                //鐢婚潰鍏抽棴
-                dialogForm.CloseDialog();
+        //    bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/UpdateHomeAppGatewayName", true, Pra);
+        //    if (result == false)
+        //    {
+        //        //缂栬緫澶囦唤鍚嶇О澶辫触
+        //        string msg = Language.StringByID(R.MyInternationalizationString.uEditorBackupNameFail);
+        //        this.ShowErrorMsg(msg);
+        //        //鍏抽棴杩涘害鏉�
+        //        this.CloseProgressBar();
+        //        return;
+        //    }
 
-                //鍚嶅瓧涓�鏍锋椂锛屼笉澶勭悊
-                if (txtvalue != fileInfo.BackupName)
-                {
-                    //缂栬緫澶囦唤鍚嶇О
-                    this.EditorBackInfo(fileInfo.Id, txtvalue);
-                }
-            });
-        }
+        //    this.SetBackupInfoToForm();
+        //}
 
-        /// <summary>
-        /// 鏄剧ず娣诲姞澶囪�冨悕鐢婚潰
-        /// </summary>
-        /// <returns></returns>
-        private void ShowAddBackupForm()
-        {
-            //鐢熸垚涓�涓脊绐楃敾闈�
-            var dialogForm = new DialogInputFrameControl(this, DialogFrameMode.OnlyInput);
+        //#endregion
 
-            //娣诲姞澶囦唤
-            dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddBackup));
-            //璇疯緭鍏ュ娉ㄥ悕绉�
-            dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup));
+        //#region 鈻� 鍒犻櫎澶囦唤鏂囨。_______________________
 
-            //鎸変笅纭鎸夐挳
-            dialogForm.ComfirmClickEvent += (() =>
-            {
-                string txtvalue = dialogForm.InputText;
-                //妫�娴嬪鑰冨悕绉�
-                if (this.CheckBackupName(txtvalue) == false)
-                {
-                    return;
-                }
+        ///// <summary>
+        ///// 鍒犻櫎澶囦唤鏂囨。
+        ///// </summary>
+        ///// <param name="BackupClassId"></param>
+        ///// <param name="showMode"></param>
+        //public async void DeleteBackInfo(string BackupClassId, ShowErrorMode showMode = ShowErrorMode.YES)
+        //{
+        //    //杩涘害鏉�
+        //    this.ShowProgressBar();
 
-                //鐢婚潰鍏抽棴
-                dialogForm.CloseDialog();
+        //    bool success = await HdlBackupLogic.Current.DeleteDbBackupData(BackupClassId);
 
-                //涓婁紶澶囦唤
-                this.UpLoadBackInfo(txtvalue);
-            });
-        }
+        //    //鍏抽棴杩涘害鏉�
+        //    this.CloseProgressBar();
 
-        #endregion
+        //    if (success == false)
+        //    {
+        //        if (showMode == ShowErrorMode.YES)
+        //        {
+        //            //鍒犻櫎澶囦唤澶辫触
+        //            string msg = Language.StringByID(R.MyInternationalizationString.uDeleteBackupFail);
+        //            this.ShowErrorMsg(msg);
+        //        }
+        //        return;
+        //    }
 
-        #region 鈻� 鑾峰彇缃戝叧鏂囦欢_______________________
+        //    this.SetBackupInfoToForm();
+        //}
 
-        /// <summary>
-        /// 灏嗙綉鍏虫枃浠跺瓨鍏ュ埌鎸囧畾鐨勮矾寰勪笅
-        /// </summary>
-        /// <returns></returns>
-        private async Task<string> SetGatewayFileInDirectory()
-        {
-            //涓婁紶缃戝叧澶囦唤鏂囦欢鍒颁簯绔殑涓存椂銆愭枃浠跺す銆�
-            string dir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.GatewayBackupDirectory);
-            Global.CreateEmptyDirectory(dir, true);
+        //#endregion
 
-            //浠庣綉鍏宠幏鍙栧畠鐨勬枃浠�
-            var listFile = await this.GetGatewayFileFromGateway();
-            if (listFile == null)
-            {
-                return null;
-            }
+        //#region 鈻� 鏄剧ず缂栬緫澶囪�冨悕鐢婚潰_________________
+
+        ///// <summary>
+        ///// 鏄剧ず缂栬緫澶囪�冨悕鐢婚潰
+        ///// </summary>
+        ///// <param name="fileInfo"></param>
+        ///// <returns></returns>
+        //private void ShowEditorBackupForm(BackupListNameInfo fileInfo)
+        //{
+        //    //鐢熸垚涓�涓脊绐楃敾闈�
+        //    var dialogForm = new DialogInputFrameControl(this, DialogFrameMode.OnlyInput);
+
+        //    //缂栬緫澶囦唤
+        //    dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorBackup));
+        //    //璇疯緭鍏ュ娉ㄥ悕绉�
+        //    dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup));
+        //    dialogForm.InputText = fileInfo.BackupName;
+
+        //    //鎸変笅纭鎸夐挳
+        //    dialogForm.ComfirmClickEvent += (() =>
+        //    {
+        //        string txtvalue = dialogForm.InputText;
+        //        //妫�娴嬪鑰冨悕绉�
+        //        if (this.CheckBackupName(txtvalue) == false)
+        //        {
+        //            return;
+        //        }
+
+        //        //鐢婚潰鍏抽棴
+        //        dialogForm.CloseDialog();
+
+        //        //鍚嶅瓧涓�鏍锋椂锛屼笉澶勭悊
+        //        if (txtvalue != fileInfo.BackupName)
+        //        {
+        //            //缂栬緫澶囦唤鍚嶇О
+        //            this.EditorBackInfo(fileInfo.Id, txtvalue);
+        //        }
+        //    });
+        //}
+
+        ///// <summary>
+        ///// 鏄剧ず娣诲姞澶囪�冨悕鐢婚潰
+        ///// </summary>
+        ///// <returns></returns>
+        //private void ShowAddBackupForm()
+        //{
+        //    //鐢熸垚涓�涓脊绐楃敾闈�
+        //    var dialogForm = new DialogInputFrameControl(this, DialogFrameMode.OnlyInput);
+
+        //    //娣诲姞澶囦唤
+        //    dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddBackup));
+        //    //璇疯緭鍏ュ娉ㄥ悕绉�
+        //    dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup));
+
+        //    //鎸変笅纭鎸夐挳
+        //    dialogForm.ComfirmClickEvent += (() =>
+        //    {
+        //        string txtvalue = dialogForm.InputText;
+        //        //妫�娴嬪鑰冨悕绉�
+        //        if (this.CheckBackupName(txtvalue) == false)
+        //        {
+        //            return;
+        //        }
+
+        //        //鐢婚潰鍏抽棴
+        //        dialogForm.CloseDialog();
+
+        //        //涓婁紶澶囦唤
+        //        this.UpLoadBackInfo(txtvalue);
+        //    });
+        //}
+
+        //#endregion
+
+        //#region 鈻� 鑾峰彇缃戝叧鏂囦欢_______________________
+
+        ///// <summary>
+        ///// 灏嗙綉鍏虫枃浠跺瓨鍏ュ埌鎸囧畾鐨勮矾寰勪笅
+        ///// </summary>
+        ///// <returns></returns>
+        //private async Task<string> SetGatewayFileInDirectory()
+        //{
+        //    //涓婁紶缃戝叧澶囦唤鏂囦欢鍒颁簯绔殑涓存椂銆愭枃浠跺す銆�
+        //    string dir = System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, DirNameResourse.GatewayBackupDirectory);
+        //    Global.CreateEmptyDirectory(dir, true);
+
+        //    //浠庣綉鍏宠幏鍙栧畠鐨勬枃浠�
+        //    var listFile = await this.GetGatewayFileFromGateway();
+        //    if (listFile == null)
+        //    {
+        //        return null;
+        //    }
             
-            int timeOutCount = 0;
-            bool receiving = false;
+        //    int timeOutCount = 0;
+        //    bool receiving = false;
 
-            string checkTopic = Common.LocalGateway.Current.GetGatewayId(zbRealGateway) + "/FileTransfer/DownloadFile";
-            var listByteSource = new List<byte>();
-            //鎺ユ敹鏁版嵁
-            Action<string, byte[]> action = (topic, dataContent) =>
-            {
-                string[] arry = topic.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
-                string checkValue = arry[0] + "/" + arry[1] + "/" + arry[2];
-                if (arry.Length < 3 || checkValue != checkTopic)
-                {
-                    return;
-                }
-                //鍒锋柊瓒呮椂鏃堕棿
-                timeOutCount = 0;
-                byte[] fileBytes = dataContent;
-                if (fileBytes[5] != 1)
-                {
-                    if (fileBytes.Length == 2056)
-                    {
-                        var tempBytes = new byte[2048];
-                        System.Array.Copy(fileBytes, 8, tempBytes, 0, 2048);
-                        listByteSource.AddRange(tempBytes);
-                    }
-                    else
-                    {
-                        var tempBytes = new byte[fileBytes.Length - 8];
-                        System.Array.Copy(fileBytes, 8, tempBytes, 0, tempBytes.Length);
-                        listByteSource.AddRange(tempBytes);
-                    }
-                }
-                else
-                {
-                    var tempBytes = new byte[fileBytes.Length - 8];
-                    System.Array.Copy(fileBytes, 8, tempBytes, 0, tempBytes.Length);
-                    listByteSource.AddRange(tempBytes);
+        //    string checkTopic = Common.LocalGateway.Current.GetGatewayId(zbRealGateway) + "/FileTransfer/DownloadFile";
+        //    var listByteSource = new List<byte>();
+        //    //鎺ユ敹鏁版嵁
+        //    Action<string, byte[]> action = (topic, dataContent) =>
+        //    {
+        //        string[] arry = topic.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
+        //        string checkValue = arry[0] + "/" + arry[1] + "/" + arry[2];
+        //        if (arry.Length < 3 || checkValue != checkTopic)
+        //        {
+        //            return;
+        //        }
+        //        //鍒锋柊瓒呮椂鏃堕棿
+        //        timeOutCount = 0;
+        //        byte[] fileBytes = dataContent;
+        //        if (fileBytes[5] != 1)
+        //        {
+        //            if (fileBytes.Length == 2056)
+        //            {
+        //                var tempBytes = new byte[2048];
+        //                System.Array.Copy(fileBytes, 8, tempBytes, 0, 2048);
+        //                listByteSource.AddRange(tempBytes);
+        //            }
+        //            else
+        //            {
+        //                var tempBytes = new byte[fileBytes.Length - 8];
+        //                System.Array.Copy(fileBytes, 8, tempBytes, 0, tempBytes.Length);
+        //                listByteSource.AddRange(tempBytes);
+        //            }
+        //        }
+        //        else
+        //        {
+        //            var tempBytes = new byte[fileBytes.Length - 8];
+        //            System.Array.Copy(fileBytes, 8, tempBytes, 0, tempBytes.Length);
+        //            listByteSource.AddRange(tempBytes);
 
-                    string [] Arryfile = listFile[0].Split(new string[] { "/" }, StringSplitOptions.None);
-                    string fileName = Arryfile[Arryfile.Length - 1];
-                    //灏嗚緭鍏ュ啓鍏ユ湰鍦扮殑涓存椂鏂囦欢澶�
-                    Global.WriteFileToDirectoryByBytes(dir, fileName, listByteSource.ToArray());
-                    listByteSource.Clear();
+        //            string [] Arryfile = listFile[0].Split(new string[] { "/" }, StringSplitOptions.None);
+        //            string fileName = Arryfile[Arryfile.Length - 1];
+        //            //灏嗚緭鍏ュ啓鍏ユ湰鍦扮殑涓存椂鏂囦欢澶�
+        //            Global.WriteFileToDirectoryByBytes(dir, fileName, listByteSource.ToArray());
+        //            listByteSource.Clear();
 
-                    //绉婚櫎姝诲惊鐜唴鐨勬寚瀹氱洰鏍�
-                    listFile.RemoveAt(0);
-                    receiving = false;
-                }
-            };
-            zbRealGateway.FileContentAction += action;
+        //            //绉婚櫎姝诲惊鐜唴鐨勬寚瀹氱洰鏍�
+        //            listFile.RemoveAt(0);
+        //            receiving = false;
+        //        }
+        //    };
+        //    zbRealGateway.FileContentAction += action;
 
-            //璁剧疆杩涘害鏉$殑鏈�澶у��
-            this.SetProgressMax(listFile.Count);
+        //    //璁剧疆杩涘害鏉$殑鏈�澶у��
+        //    this.SetProgressMax(listFile.Count);
 
-            while (listFile.Count > 0)
-            {
-                timeOutCount++;
-                if (timeOutCount == 150)
-                {
-                    //30绉掕秴鏃�:鍝嶅簲瓒呮椂,鑾峰彇缃戝叧鏂囦欢澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uResponseTimeoutsAndGetGatewayFileFail);
-                    this.ShowErrorMsg(msg);
-                    zbRealGateway.FileContentAction -= action;
-                    return null;
-                }
+        //    while (listFile.Count > 0)
+        //    {
+        //        timeOutCount++;
+        //        if (timeOutCount == 150)
+        //        {
+        //            //30绉掕秴鏃�:鍝嶅簲瓒呮椂,鑾峰彇缃戝叧鏂囦欢澶辫触
+        //            string msg = Language.StringByID(R.MyInternationalizationString.uResponseTimeoutsAndGetGatewayFileFail);
+        //            this.ShowErrorMsg(msg);
+        //            zbRealGateway.FileContentAction -= action;
+        //            return null;
+        //        }
 
-                //鎺ユ敹涓�
-                if (receiving == true)
-                {
-                    await Task.Delay(200);
-                    continue;
-                }
-                receiving = true;
+        //        //鎺ユ敹涓�
+        //        if (receiving == true)
+        //        {
+        //            await Task.Delay(200);
+        //            continue;
+        //        }
+        //        receiving = true;
 
-                string[] Arryfile = listFile[0].Split(new string[] { "/" }, StringSplitOptions.None);
-                string fileName = Arryfile[Arryfile.Length - 1];
-                //涓嬭浇鏂囦欢
-                var saveFileName = await zbRealGateway.SetDownloadFileAsync(fileName);
-                //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜
-                var error = UserCenterLogic.CheckCommonErrorCode(saveFileName);
-                if (error != null)
-                {
-                    this.ShowTip(error);
-                    zbRealGateway.FileContentAction -= action;
-                    return null;
-                }
-                if (saveFileName == null || saveFileName.setDownloadFileResponseData == null || saveFileName.setDownloadFileResponseData.Result != 0)
-                {
-                    //鑾峰彇缃戝叧鏂囦欢澶辫触
-                    string msg = Language.StringByID(R.MyInternationalizationString.uGetGatewayFileFail);
-                    this.ShowErrorMsg(msg);
-                    zbRealGateway.FileContentAction -= action;
-                    return null;
-                }
-                //璁剧疆杩涘害鍊�
-                this.SetProgressValue(1);
-            }
-            zbRealGateway.FileContentAction -= action;
+        //        string[] Arryfile = listFile[0].Split(new string[] { "/" }, StringSplitOptions.None);
+        //        string fileName = Arryfile[Arryfile.Length - 1];
+        //        //涓嬭浇鏂囦欢
+        //        var saveFileName = await zbRealGateway.SetDownloadFileAsync(fileName);
+        //        //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜
+        //        var error = HdlCheckLogic.Current.CheckCommonErrorCode(saveFileName);
+        //        if (error != null)
+        //        {
+        //            this.ShowMassage(error);
+        //            zbRealGateway.FileContentAction -= action;
+        //            return null;
+        //        }
+        //        if (saveFileName == null || saveFileName.setDownloadFileResponseData == null || saveFileName.setDownloadFileResponseData.Result != 0)
+        //        {
+        //            //鑾峰彇缃戝叧鏂囦欢澶辫触
+        //            string msg = Language.StringByID(R.MyInternationalizationString.uGetGatewayFileFail);
+        //            this.ShowErrorMsg(msg);
+        //            zbRealGateway.FileContentAction -= action;
+        //            return null;
+        //        }
+        //        //璁剧疆杩涘害鍊�
+        //        this.SetProgressValue(1);
+        //    }
+        //    zbRealGateway.FileContentAction -= action;
+        //    action = null;
 
-            return dir;
-        }
+        //    return dir;
+        //}
 
-        /// <summary>
-        /// 浠庣綉鍏宠幏鍙栧畠鐨勬枃浠�
-        /// </summary>
-        /// <returns></returns>
-        private async Task<List<string>> GetGatewayFileFromGateway()
-        {
-            var fileData = await zbRealGateway.FileTransferLsDirAsync();
-            //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜
-            string error = UserCenterLogic.CheckCommonErrorCode(fileData);
-            if (error != null)
-            {
-                this.ShowErrorMsg(error);
-                return null;
-            }
+        ///// <summary>
+        ///// 浠庣綉鍏宠幏鍙栧畠鐨勬枃浠�
+        ///// </summary>
+        ///// <returns></returns>
+        //private async Task<List<string>> GetGatewayFileFromGateway()
+        //{
+        //    var fileData = await zbRealGateway.FileTransferLsDirAsync();
+        //    //妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜
+        //    string error = HdlCheckLogic.Current.CheckCommonErrorCode(fileData);
+        //    if (error != null)
+        //    {
+        //        this.ShowErrorMsg(error);
+        //        return null;
+        //    }
 
-            if (fileData == null || fileData.fileTransferLsDiResponseData == null || fileData.fileTransferLsDiResponseData.Result != 0)
-            {
-                //鑾峰彇缃戝叧鏂囦欢澶辫触
-                string msg = Language.StringByID(R.MyInternationalizationString.uGetGatewayFileFail);
-                this.ShowErrorMsg(msg);
-                return null;
-            }
-            var listFile = new List<string>();
-            foreach (var filedata in fileData.fileTransferLsDiResponseData.Dir)
-            {
-                listFile.Add(filedata.File);
-            }
-            return listFile;
-        }
+        //    if (fileData == null || fileData.fileTransferLsDiResponseData == null || fileData.fileTransferLsDiResponseData.Result != 0)
+        //    {
+        //        //鑾峰彇缃戝叧鏂囦欢澶辫触
+        //        string msg = Language.StringByID(R.MyInternationalizationString.uGetGatewayFileFail);
+        //        this.ShowErrorMsg(msg);
+        //        return null;
+        //    }
+        //    var listFile = new List<string>();
+        //    foreach (var filedata in fileData.fileTransferLsDiResponseData.Dir)
+        //    {
+        //        listFile.Add(filedata.File);
+        //    }
+        //    return listFile;
+        //}
 
-        #endregion
+        //#endregion
 
-        #region 鈻� 涓�鑸柟娉昣__________________________
+        //#region 鈻� 涓�鑸柟娉昣__________________________
 
-        /// <summary>
-        /// 妫�娴嬪鑰冨悕绉�
-        /// </summary>
-        /// <param name="backName"></param>
-        /// <returns></returns>
-        private bool CheckBackupName(string backName)
-        {
-            if (backName == string.Empty)
-            {
-                //璇疯緭鍏ュ娉ㄥ悕绉�
-                string msg = Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup);
-                this.ShowErrorMsg(msg);
-                return false;
-            }
-            return true;
-        }
-        #endregion
+        ///// <summary>
+        ///// 妫�娴嬪鑰冨悕绉�
+        ///// </summary>
+        ///// <param name="backName"></param>
+        ///// <returns></returns>
+        //private bool CheckBackupName(string backName)
+        //{
+        //    if (backName == string.Empty)
+        //    {
+        //        //璇疯緭鍏ュ娉ㄥ悕绉�
+        //        string msg = Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup);
+        //        this.ShowErrorMsg(msg);
+        //        return false;
+        //    }
+        //    return true;
+        //}
+        //#endregion
     }
 }

--
Gitblit v1.8.0