| | |
| | | /// </summary>
|
| | | /// <param name="realGateway">真实物理网关对象</param>
|
| | | /// <param name="backupName">需要创建的备份的名字</param>
|
| | | public async void DoBackupGateway(ZbGateway realGateway, string backupName)
|
| | | public void DoBackupGateway(ZbGateway realGateway, string backupName)
|
| | | {
|
| | | //展开进度条
|
| | | ProgressFormBar.Current.Start();
|
| | | //创建备份文件
|
| | | ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uCreatBackupFile));
|
| | | await System.Threading.Tasks.Task.Delay(1000);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | |
|
| | | //创建一个备份名字
|
| | | string backupClassId = await HdlBackupLogic.Current.CreatNewBackupNameToDB(backupName, 2, HdlGatewayLogic.Current.GetGatewayId(realGateway));
|
| | | string backupClassId = HdlBackupLogic.Current.CreatNewBackupNameToDB(backupName, 2, realGateway.GwId);
|
| | | if (backupClassId == null)
|
| | | {
|
| | | //关闭进度条
|
| | |
| | | if (result == false)
|
| | | {
|
| | | //如果上传失败的话,就把它删除
|
| | | await HdlBackupLogic.Current.DeleteDbBackupData(backupClassId);
|
| | | HdlBackupLogic.Current.DeleteDbBackupData(backupClassId);
|
| | | //关闭进度条
|
| | | ProgressFormBar.Current.Close();
|
| | | return;
|
| | |
| | | this.ShowErrorMsg(msg);
|
| | | return false;
|
| | | }
|
| | | System.Threading.Thread.Sleep(1000);
|
| | |
|
| | | return success;
|
| | | }
|
| | |
|
| | |
| | | var data = new Newtonsoft.Json.Linq.JObject {
|
| | | { "url", fullUrl }, { "RequestVersion", Common.CommonPage.RequestVersion },
|
| | | { "LoginAccessToken", UserCenterLogic.GetConnectMainToken() }, { "IsGatewayAutoBackup", isAutoBack },
|
| | | { "BackupClassId", backupClassId },{ "GatewayUniqueId",HdlGatewayLogic.Current.GetGatewayId(realGateway)},
|
| | | { "BackupClassId", backupClassId },{ "GatewayUniqueId",realGateway.GwId},
|
| | | { "IsOtherAccountCtrl",connectMode == HttpConnectMode.Admin?1:0}
|
| | | };
|
| | | jObject.Add("Data", data);
|
| | |
| | | var data = new Newtonsoft.Json.Linq.JObject {
|
| | | { "url", fullUrl }, { "RequestVersion", Common.CommonPage.RequestVersion },
|
| | | { "LoginAccessToken", UserCenterLogic.GetConnectMainToken() }, { "IsGatewayAutoBackup", isAutoBack },
|
| | | { "BackupClassId", backupClassId },{ "GatewayUniqueId",HdlGatewayLogic.Current.GetGatewayId(realGateway)},
|
| | | { "BackupClassId", backupClassId },{ "GatewayUniqueId",realGateway.GwId},
|
| | | { "IsOtherAccountCtrl",connectMode == HttpConnectMode.Admin?1:0}
|
| | | };
|
| | | jObject.Add("Data", data);
|
| | |
| | | //网关已经接收到重启命令,接下来去判断网关是否重启完成
|
| | | bool gatewatAction = false;
|
| | | bool threadAction = true;
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | timeOut = 0;
|
| | | while (gatewatAction == false)
|
| | |
| | | if (timeOut >= 65 && timeOut % 5 == 0)
|
| | | {
|
| | | //5秒一次,去获取版本
|
| | | var data = await HdlGatewayLogic.Current.GetGatewayNewInfoAsync(realGateway, ShowErrorMode.NO);
|
| | | var data = HdlGatewayLogic.Current.GetGatewayInfo(realGateway, false, ShowErrorMode.NO);
|
| | | if (data != null)
|
| | | {
|
| | | gatewatAction = true;
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | await System.Threading.Tasks.Task.Delay(1000);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | timeOut++;
|
| | | //设置进度值
|
| | | ProgressFormBar.Current.SetValue(timeOut, 180);
|
| | |
| | | }
|
| | | if (gatewatAction == true)
|
| | | {
|
| | | //设置进度值:100%
|
| | | ProgressFormBar.Current.SetValue(1, 1);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | //网关数据恢复成功!
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uRestoreGatewayDataSuccess);
|
| | | this.ShowTipMsg(msg);
|