old mode 100755
new mode 100644
| | |
| | | /// <param name="realGateway">真实物理网关对象</param>
|
| | | /// <param name="backupId">备份主键</param>
|
| | | /// <param name="isAutoBack">0:获取网关手动备份文件列表 1:获取网关自动备份文件列表</param>
|
| | | public bool RecoverGateway(ZbGateway realGateway, string backupId, int isAutoBack)
|
| | | /// <param name="closeBar">是否关闭进度条</param> |
| | | public bool RecoverGateway(ZbGateway realGateway, string backupId, int isAutoBack, bool closeBar = true) |
| | | {
|
| | | //展开进度条
|
| | | ProgressFormBar.Current.Start();
|
| | |
| | |
|
| | | //重启网关系统
|
| | | result = this.GatewayReboot(realGateway);
|
| | | |
| | | if (result == true) |
| | | { |
| | | //刷新全部场景 |
| | | HdlSceneLogic.Current.RefreshSceneUIList(false); |
| | | //获取全部设备 |
| | | Common.LocalDevice.Current.SetDeviceToMemmoryByGateway(realGateway.GwId, false); |
| | | } |
| | | if (closeBar == true) |
| | | { |
| | | //关闭进度条
|
| | | ProgressFormBar.Current.Close();
|
| | | } |
| | | return result;
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | //正在获取备份文件列表
|
| | | ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uBackupFileListGetting));
|
| | | ProgressFormBar.Current.SetValue(0);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | |
|
| | | int result = -1;
|
| | |
| | | {
|
| | | //正在下载备份文件
|
| | | ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uBackupFileDownloading));
|
| | | ProgressFormBar.Current.SetValue(0);
|
| | | ProgressFormBar.Current.ResetProgressBar(); |
| | | System.Threading.Thread.Sleep(1000);
|
| | |
|
| | | bool threadAction = true;
|
| | |
| | | timeOut = 0;
|
| | | //设置进度百分比
|
| | | var persent = Convert.ToInt32(jobject["Data"]["RestoreDataPercent"].ToString());
|
| | | ProgressFormBar.Current.SetValue(persent, 100);
|
| | | //网关下载完成之后,它自己会卡一会,才会发送2过来 |
| | | ProgressFormBar.Current.SetValue(persent - 1, 100); |
| | | }
|
| | | }
|
| | | };
|
| | |
| | | {
|
| | | //正在重启网关系统
|
| | | ProgressFormBar.Current.SetMsg(Language.StringByID(R.MyInternationalizationString.uGatewayRerooting));
|
| | | ProgressFormBar.Current.SetValue(0);
|
| | | ProgressFormBar.Current.ResetProgressBar(); |
| | | System.Threading.Thread.Sleep(1000);
|
| | |
|
| | | int result = -1;
|
| | |
| | | }
|
| | |
|
| | | //网关已经接收到重启命令,接下来去判断网关是否重启完成
|
| | | bool gatewatAction = false;
|
| | | bool threadAction = true;
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | timeOut = 0;
|
| | | while (gatewatAction == false)
|
| | | while (true) |
| | | {
|
| | | //大概网关重启要60秒
|
| | | if (timeOut >= 65 && timeOut % 5 == 0)
|
| | |
| | | var data = HdlGatewayLogic.Current.GetGatewayInfo(realGateway, false, ShowErrorMode.NO);
|
| | | if (data != null)
|
| | | {
|
| | | gatewatAction = true;
|
| | | threadAction = false;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | if (timeOut >= 180)
|
| | | {
|
| | | //180秒还等不到的话,网关应该出问题了
|
| | | threadAction = false;
|
| | | break;
|
| | | }
|
| | | }
|
| | | });
|
| | | while (threadAction == true)
|
| | | {
|
| | | System.Threading.Thread.Sleep(4000);
|
| | | }
|
| | | if (gatewatAction == true)
|
| | | if (timeOut < 180) |
| | | {
|
| | | //设置进度值:100%
|
| | | ProgressFormBar.Current.SetValue(1, 1);
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | //网关数据恢复成功!
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uRestoreGatewayDataSuccess);
|
| | | this.ShowTipMsg(msg);
|
| | | return true;
|
| | | }
|
| | | else
|