如题
想实现如果系统有最新版本,窗口提示升级
登陆窗口打开后执行下面代码,
操作过程中系统升级后,再打开,提示报错见下图:
try
If FileSys.FileExists(ProjectPath & "update.txt") Then '如果指定的文件存在
FileSys.DeleteFile(ProjectPath & "update.txt",2,2) '则彻底删除之
End If
'Network.DownloadFile("O:\协同办公系统\在线升级路径\update.txt", ProjectPath &"\update.txt" ,"" ,"" ,False, 100000, True)
Network.DownloadFile(updatepath & "/update.txt",ProjectPath &"update.txt" ,"" ,"" ,False, 100000, True)
Dim ud() As String = FileSys.ReadAllText("O:\协同办公系统\在线升级路径\update.txt").Split("|")
Dim Sdate1 As Date = Cdate(ud(0)) '服务器update.txt发布日期
Dim Sdate2 As Date = Cdate(ud(1)) '服务器Version.txt发布日期
Dim Cdate1 As Date = PublishDate '客户端发布日期
Dim Cdate2 As Date = FileSys.ReadAllText(ProjectPath & "\Bin\Version.txt") '客户端Version.txt发布日期
If Sdate2 > Cdate2 Then '如果服务器程序发布日期大于客户端发布日期(大升级)
'升级代码
Syscmd.Project.Update()
ElseIf Sdate1 > Cdate1 Then '如果服务器版本发布日期大于客户端发布日期(小升级)
'升级代码
Syscmd.Project.Update()
End If
catch ex As exception
msgbox("不用升级")
End try
此主题相关图片如下:报错.jpg
[此贴子已经被作者于2018/10/18 16:46:37编辑过]