| | |
| | | this.ShowProgressBar();
|
| | |
|
| | | //获取自动备份的数据
|
| | | var pageAuto = HdlBackupLogic.Current.GetBackupListNameFromDB(3, realGateway.GwId);
|
| | | if (pageAuto == null)
|
| | | var listAutoData = HdlGatewayBackupLogic.Current.GetGatewayBackupListFromDb(realGateway.GwId, BackUpMode.A自动备份);
|
| | | if (listAutoData == null)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar(ShowReLoadMode.YES);
|
| | | return;
|
| | | }
|
| | |
|
| | | //从云端获取数据 |
| | | var pageData = HdlBackupLogic.Current.GetBackupListNameFromDB(2, realGateway.GwId);
|
| | | if (pageData == null)
|
| | | //从云端获取手动备份数据 |
| | | var listHandData = HdlGatewayBackupLogic.Current.GetGatewayBackupListFromDb(realGateway.GwId, BackUpMode.A手动备份);
|
| | | if (listHandData == null)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar(ShowReLoadMode.YES);
|
| | |
| | | {
|
| | | listView.RemoveAll();
|
| | | listView.RecoverHeight();
|
| | |
|
| | | //自动备份的ID
|
| | | string autoID = string.Empty;
|
| | | if (pageAuto.Count > 0)
|
| | | if (listAutoData.Count > 0)
|
| | | {
|
| | | autoID = pageAuto[0].Id;
|
| | | //添加自动备份行
|
| | | this.AddRowlayout(pageAuto[0], pageData.Count > 0, true);
|
| | | this.AddRowlayout(listAutoData[0], listAutoData.Count > 0, true);
|
| | | }
|
| | |
|
| | | for (int i = 0; i < pageData.Count; i++)
|
| | | for (int i = 0; i < listHandData.Count; i++)
|
| | | {
|
| | | //添加备份行
|
| | | this.AddRowlayout(pageData[i], i != pageData.Count - 1, false);
|
| | | this.AddRowlayout(listHandData[i], i != listHandData.Count - 1, false);
|
| | | }
|
| | |
|
| | | this.btnDownload?.RemoveFromParent();
|
| | | if (pageData.Count > 0 || pageAuto.Count > 0)
|
| | | if (listAutoData.Count > 0 || listHandData.Count > 0)
|
| | | {
|
| | | //下载
|
| | | this.btnDownload = new BottomClickButton();
|
| | |
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //读取备份文档
|
| | | bool result = HdlGatewayBackupLogic.Current.RecoverGateway(this.realGateway, this.nowSelectBackId, autoID == this.nowSelectBackId ? 1 : 0);
|
| | | bool result = HdlGatewayBackupLogic.Current.RecoverGateway(this.realGateway.GwId, this.nowSelectBackId);
|
| | | if (result == true)
|
| | | {
|
| | | //网关数据恢复成功!
|
| | | msg = Language.StringByID(R.MyInternationalizationString.uRestoreGatewayDataSuccess);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //关闭这个界面
|
| | |
| | | listView.AddChidren(rowLayout);
|
| | |
|
| | | //备份名字
|
| | | var txtText = rowLayout.frameTable.AddTopView(fileInfo.BackupName, 700);
|
| | | var txtText = rowLayout.frameTable.AddTopView(fileInfo.FolderName, 700);
|
| | | if (isAuto == true)
|
| | | {
|
| | | txtText.TextID = R.MyInternationalizationString.uAutoBackup;
|
| | | }
|
| | |
|
| | | //时间 2019-11-11T11:31:01
|
| | | //时间
|
| | | var btnTime = rowLayout.frameTable.AddBottomView("", 600);
|
| | | if (fileInfo.CreatedOnUtc.Length >= 19)
|
| | | if (fileInfo.ModifyTime.Length == 13)
|
| | | {
|
| | | btnTime.Text = UserCenterLogic.ConvertUtcTimeToLocalTime(fileInfo.CreatedOnUtc).ToString("yyyy.MM.dd HH:mm:ss");
|
| | | btnTime.Text = HdlCommonLogic.Current.ConvertUtcTimeToLocalTime2(fileInfo.ModifyTime).ToString("yyyy.MM.dd HH:mm:ss");
|
| | | }
|
| | | //底线
|
| | | if (addLine == true)
|
| | |
| | | /// <summary>
|
| | | /// 编辑备份名称
|
| | | /// </summary>
|
| | | /// <param name="BackupClassId"></param>
|
| | | /// <param name="backupClassId"></param>
|
| | | /// <param name="backName"></param>
|
| | | private void EditorBackInfo(string BackupClassId, string backName)
|
| | | private void EditorBackInfo(string backupClassId, string backName)
|
| | | {
|
| | | var Pra = new EditorBackUpNamePra();
|
| | | Pra.BackupClassId = BackupClassId;
|
| | | Pra.BackupName = backName;
|
| | | //获取控制主人账号的Token
|
| | | Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
|
| | |
|
| | | bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/UpdateHomeAppGatewayName", true, Pra);
|
| | | var result = HdlGatewayBackupLogic.Current.EditorGatewayBackupName(backupClassId, backName);
|
| | | if (result == false)
|
| | | {
|
| | | return;
|
| | |
| | | /// <summary>
|
| | | /// 删除备份文档
|
| | | /// </summary>
|
| | | /// <param name="BackupClassId"></param>
|
| | | private void DeleteBackInfo(string BackupClassId)
|
| | | /// <param name="backupClassId"></param>
|
| | | private void DeleteBackInfo(string backupClassId)
|
| | | {
|
| | | bool success = HdlBackupLogic.Current.DeleteDbBackupData(BackupClassId);
|
| | | bool success = HdlGatewayBackupLogic.Current.DeleteGatewayBackup(this.realGateway.GwId, backupClassId);
|
| | | if (success == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (this.nowSelectBackId == BackupClassId)
|
| | | if (this.nowSelectBackId == backupClassId)
|
| | | {
|
| | | this.nowSelectBackId = string.Empty;
|
| | | this.nowbtnSelect = null;
|
| | |
| | | private void ShowEditorBackupForm(BackupListNameInfo fileInfo)
|
| | | {
|
| | | //生成一个弹窗画面
|
| | | var dialogForm = new DialogInputControl();
|
| | |
|
| | | //编辑备份
|
| | | dialogForm.SetTitleText(Language.StringByID(R.MyInternationalizationString.uEditorBackup));
|
| | | //请输入备份名称
|
| | | dialogForm.SetTipText(Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName));
|
| | | dialogForm.Text = fileInfo.BackupName;
|
| | |
|
| | | //按下确认按钮
|
| | | dialogForm.ComfirmClickEvent += ((txtvalue) =>
|
| | | this.ShowDialogInputForm(Language.StringByID(R.MyInternationalizationString.uEditorBackup), fileInfo.FolderName,
|
| | | Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName), (contr, txtvalue) =>
|
| | | {
|
| | | //画面关闭
|
| | | dialogForm.CloseDialog();
|
| | | contr.CloseDialog();
|
| | | //名字一样时,不处理
|
| | | if (txtvalue != fileInfo.BackupName)
|
| | | if (txtvalue != fileInfo.FolderName)
|
| | | {
|
| | | //编辑备份名称
|
| | | this.EditorBackInfo(fileInfo.Id, txtvalue);
|