|
@@ -390,7 +390,7 @@ namespace MV485.uc
|
|
|
{
|
|
|
Owner = Application.Current.MainWindow,
|
|
|
WindowStartupLocation = WindowStartupLocation.CenterOwner
|
|
|
- };
|
|
|
+ };
|
|
|
waitWindow.Show();
|
|
|
Application.Current.MainWindow.IsEnabled = false;
|
|
|
try
|
|
@@ -445,9 +445,12 @@ namespace MV485.uc
|
|
|
//});
|
|
|
};
|
|
|
|
|
|
- waitWindow.StopUpgrade += () =>
|
|
|
+ waitWindow.StopUpgrade += async () =>
|
|
|
{
|
|
|
-
|
|
|
+ deviceUpgrade.StopSendFile();
|
|
|
+ upgradeHis.UpgradeResult = -1; //升级失败
|
|
|
+ await UpdateUpgradeResult(upgradeHis);
|
|
|
+ return;
|
|
|
};
|
|
|
|
|
|
bool blSend = await deviceUpgrade.StartSendFileAsync(progress, portName, baudrate, fileData);
|
|
@@ -459,13 +462,13 @@ namespace MV485.uc
|
|
|
//提示继续等待设备重启,并验证升级是否成功
|
|
|
//MessageBox.Show(Application.Current.MainWindow,"向设备写入新固件成功,")
|
|
|
|
|
|
- MessageBoxResult result = MessageBox.Show("向设备写入新固件成功,设备即将重启。\n是否等待自动验证重启后的版本是否正确",
|
|
|
- "确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
|
+ //MessageBoxResult result = MessageBox.Show("向设备写入新固件成功,设备即将重启。\n是否等待自动验证重启后的版本是否正确",
|
|
|
+ // "确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
|
|
|
|
|
- if (result == MessageBoxResult.No) return;
|
|
|
+ //if (result == MessageBoxResult.No) return;
|
|
|
|
|
|
//继续等待失败是否成功
|
|
|
- titleInfo = $"正在等待验证重启后版本是否正确(1~2分钟)";
|
|
|
+ titleInfo = $"向设备写入新固件成功,设备即将重启。\n正在等待验证重启后版本是否正确(1~2分钟)。";
|
|
|
waitWindow.TitleInfo = titleInfo;
|
|
|
|
|
|
//进入等待线程
|
|
@@ -485,7 +488,7 @@ namespace MV485.uc
|
|
|
// return blReadFireware;
|
|
|
//}
|
|
|
if (blReadFireware) return true;
|
|
|
- Task.Delay(1000);
|
|
|
+ Task.Delay(3000);
|
|
|
timeout -= 1000;
|
|
|
}
|
|
|
return false;
|
|
@@ -499,7 +502,7 @@ namespace MV485.uc
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- MessageBox.Show(Application.Current.MainWindow, "等待验证超时", "警告",
|
|
|
+ MessageBox.Show(Application.Current.MainWindow, "等待验证超时,请手动检查升级后的版本是否正确。", "警告",
|
|
|
MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
|
}
|
|
|
}
|
|
@@ -517,7 +520,6 @@ namespace MV485.uc
|
|
|
waitWindow.Close();
|
|
|
Application.Current.MainWindow.IsEnabled = true;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private async void BtnClearUpgradeHis_Click(object sender, RoutedEventArgs e)
|