HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-12-14 e90209beae6a4e822cecb18e6889f8bda23f630e
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();
            //    //自动备份的ID
            //    string autoID = string.Empty;
            //    if (pageAuto.Count > 0)
            //    {
            //        autoID = pageAuto[0].Id;
            //        //添加自动备份行
            //        this.AddRowlayout(pageAuto[0], pageData.Count > 0, true);
            //    }
                //自动备份的ID
                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;
            ////获取控制主人账号的Token
            //Pra.LoginAccessToken = HdlUserCenterLogic.GetConnectMainToken();
            var Pra = new EditorBackUpNamePra();
            Pra.BackupClassId = BackupClassId;
            Pra.BackupName = backName;
            //获取控制主人账号的Token
            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);