Reputation: 4662
We have two applications.
My problem is preventing users from getting into the main.exe while updating.
Right now, I am checking for a flag file and if the flag file exists, application.exe immediately.
This is fine except it doesn't tell the user anything, just kicks them out.
I were to issue a message, the time that it takes for them to respond to the message, the main.exe is in use and cannot be updated.
Any suggestions how I can professionally display a message that the update is in progress, application closing?
btw, I thought about using:
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
but what do I call to display the message?
Thanks in advance!
Upvotes: 0
Views: 84
Reputation: 62248
Considering the data we have
On update request from Main.exe
the Main.exe
launches Updater.exe
end kills itself.
Updater.exe
does it stuff. To resolving notification problem in case when user clicks on Main.exe
again you can, for example, launch the second instance of Updater.exe
with some special parameter, which actualy diplays a message and exit from Main.exe
. In this case even if user will not close the notification dialog box for a while (cofee pause), you will have contemporary in memory 2 instances of Updater.exe
. One is updating, the second simply shows the message and one time message closed leaves the memory.
In short, move message visualization inside Updater.exe
itself, which appears only in case of presence of special command line parameter.
Hope this helps.
Upvotes: 1
Reputation: 18965
There are several possible solutions to this problem, including:
Create a simple bootstrap application which checks for the flag file and if it doesn't exist then launch the main.exe. Otherwise prompt the user with your error. This only works if you never have to update the boostrapper.
Use AppDomain shadow copy to allow your users access to your application while it is updating then once it is finished prompt them to restart and the updated files will overwrite the "active" ones.
Upvotes: 1