| | |
| | | /// </summary>
|
| | | private async void SetBackupInfoToForm()
|
| | | {
|
| | | this.nowSelectBackId = string.Empty;
|
| | | this.nowbtnSelect = null;
|
| | |
|
| | | //进度条
|
| | | this.ShowProgressBar();
|
| | |
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDownLoadAndRecoverMsg);
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, () =>
|
| | | {
|
| | | this.LoadBackupInfo(this.nowSelectBackId);
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //读取备份文档
|
| | | bool result = HdlGatewayBackupLogic.Current.RecoverGateway(this.realGateway, this.nowSelectBackId);
|
| | | if (result == true)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //关闭这个界面
|
| | | this.CloseForm();
|
| | | });
|
| | | }
|
| | | });
|
| | | });
|
| | | };
|
| | | //调整真实高度
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 读取备份文档_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 读取备份文档
|
| | | /// </summary>
|
| | | /// <param name="BackupClassId"></param>
|
| | | private void LoadBackupInfo(string BackupClassId)
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | //获取网关上面存在的全部文件
|
| | | var listFile = await this.GetGatewayFileFromGateway();
|
| | | if (listFile == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //从云端获取备份的文件
|
| | | bool result = await HdlBackupLogic.Current.LoadGatewayBackupInfo(BackupClassId, realGateway, listFile);
|
| | | if (result == false)
|
| | | {
|
| | | //网关恢复失败
|
| | | string msg2 = Language.StringByID(R.MyInternationalizationString.uGatewayFileRecoverFail);
|
| | | this.ShowMassage(ShowMsgType.Error, msg2);
|
| | | return;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //关闭自身
|
| | | this.CloseForm();
|
| | | });
|
| | |
|
| | | //网关恢复成功
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGatewayFileRecoverSuccess);
|
| | | this.ShowMassage(ShowMsgType.Normal, msg);
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 编辑备份名称_______________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取网关文件_______________________
|
| | |
|
| | | /// <summary>
|
| | | /// 从网关获取它的文件
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private async System.Threading.Tasks.Task<List<string>> GetGatewayFileFromGateway()
|
| | | {
|
| | | var fileData = await realGateway.FileTransferLsDirAsync();
|
| | | //检测网关返回的共通错误状态码
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(fileData);
|
| | | if (error != null)
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Error, error);
|
| | | return null;
|
| | | }
|
| | |
|
| | | if (fileData == null || fileData.fileTransferLsDiResponseData == null || fileData.fileTransferLsDiResponseData.Result != 0)
|
| | | {
|
| | | //获取网关文件失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetGatewayFileFail);
|
| | | this.ShowMassage(ShowMsgType.Error, msg);
|
| | | return null;
|
| | | }
|
| | | var listFile = new List<string>();
|
| | | foreach (var filedata in fileData.fileTransferLsDiResponseData.Dir)
|
| | | {
|
| | | listFile.Add(filedata.File);
|
| | | }
|
| | | return listFile;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | #endregion
|
| | | }
|