Charlotte Foust
cfoust at infostatsystems.com
Wed Jan 20 17:26:52 CST 2010
You can use a small text file on the drive as a flag. Start it when you call the installer and then keep checking for it at intervals. When it's no longer there (the installer removes it), launch the application. Or you could do it the other way around and have the installer remove a file you create just before you call it.
Charlotte
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of David McAfee
Sent: Wednesday, January 20, 2010 2:28 PM
To: Discussion concerning Visual Basic and related programming issues.
Subject: [dba-VB] VB.Net Wait for file to Download before launching
Does anyone know how to do this?
I have this program that checks for updates :
If IsUpdateAvailable() Then
DownloadUpdate()
LaunchUpdateInstaller()
LaunchApp()
Else
LaunchApp()
End If
The Update detection and Download work great:
Private Sub DownloadUpdate()
If Directory.Exists(InstallFilesPath) Then 'if the local path
exists then check for the actual file
If File.Exists(InstallFilesPath + InstallFile) Then 'Check
to see if the new file is already installed
'Delete file
File.Delete(InstallFilesPath + InstallFile)
'Then download it
DownloadFile(NetPath + InstallFile, InstallFilesPath +
InstallFile)
Else ' If the source file can't be found, Download new copy
DownloadFile(NetPath + InstallFile, InstallFilesPath +
InstallFile)
End If
Else 'Directory did not exist, so create it and copy new file over
Directory.CreateDirectory(InstallFilesPath)
DownloadFile(NetPath + InstallFile, InstallFilesPath + InstallFile)
End If
End Sub
Private Sub LaunchApp()
'This sub launches the actual Program
System.Diagnostics.Process.Start(AppPath + AppName)
End Sub
The trouble is that it wants to run the LaunchApp() sub immediatley
after calling the LaunchUpdateInstaller() sub.
I was thinking of putting in a timer of some sort, but I was wondering
if there is some quicker/better way of doing this.
MTIA,
David McAfee
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com