我们有两个应用程序。
我的问题是阻止用户在更新时进入main.exe。
现在,我正在检查一个标志文件,如果标志文件存在,立即执行application.exe。
这很好,除非它没有告诉用户什么,只是将它们踢出去。
我要发出一条消息,它们响应消息所需的时间,main.exe正在使用中,无法更新。
有关我如何能够专业地显示正在进行更新,应用程序关闭的消息的任何建议吗?
不过,我想过要用:Private Function IsUpdatingPropane() As Boolean
Try
Dim UpdateInprocess As String = My.Computer.FileSystem.GetParentPath(Application.StartupPath) & "\update.inprocess"
If File.Exists(UpdateInprocess) Then
'Dim Proc As Process
'Dim ProcInfo As New ProcessStartInfo(Configuration.DataFileLocations & Configuration.GasLibrary & "\vbmsg.exe")
'ProcInfo.Arguments = String.Format("vbmsg.txt,{0},{1},NIL,NIL,NIL,OK,9996,9997", Configuration.UserId, Configuration.WorkstationId)
'ProcInfo.WindowStyle = ProcessWindowStyle.Normal
'ProcInfo.WorkingDirectory = Configuration.DataFileLocations & Configuration.GasLibrary
'ProcInfo.UseShellExecute = False
'Proc = Process.Start(ProcInfo)
Application.Exit()
Return True
End If
Return False
Catch ex As Exception
WriteException(ex)
WriteDebugInfo("VerifyNotUpdatingPropane", "An error occurred while checking for update.inprocess file. Please contact SSS for assistance.", True, ex)
Return True
End Try
End Function
但是我打电话来显示消息?
提前致谢!
答案 0 :(得分:1)
此问题有几种可能的解决方案,包括:
创建一个简单的引导程序,检查标志文件,如果它不存在,则启动main.exe。否则会提示用户您的错误。这只有在您不必更新boostrapper时才有效。
使用AppDomain卷影副本允许用户在更新时访问您的应用程序,然后在完成后提示他们重新启动,更新的文件将覆盖“活动”应用程序。
答案 1 :(得分:1)
考虑我们的数据
来自Main.exe
的更新请求Main.exe
启动Updater.exe
结束自杀。
Updater.exe
做到了。要在用户再次点击Main.exe
时解决通知问题,您可以使用一些特殊参数启动Updater.exe
的第二个实例,该实例会显示消息并退出Main.exe
。在这种情况下,即使用户暂时不关闭通知对话框(咖啡暂停),您也将拥有当代内存 2 Updater.exe
的实例。一个是更新,第二个只是显示消息,一次消息关闭离开内存。
简而言之,在Updater.exe
内部移动消息可视化,仅在存在特殊命令行参数的情况下才会出现。
希望这有帮助。