Sub getfiles_click
Dim j1 As HttpJob
sendcover.Left = 0 ' a panel saying "Wait"
j1.Initialize("importchecktime",Me)
j1.PostString( "http://------------------/checktime","")
End Sub
Sub JobDone(j As HttpJob)
If j.Success Then
Select j.JobName
Case "download"
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal & "/codes", "temp.db", False)
File.Copy2(j.GetInputStream,out)
out.Close
If File.Size(codespath ,"temp.db") > 0 Then
File.copy(codespath ,"temp.db",codespath ,"codesB.db")
sendcover.Left = 2500dip
mymsg.Show("Update","DB updated", LoadBitmap(File.DirAssets,"warning-icon.png"),"OK","", "")
End If
File.Delete(codespath ,"temp.db")
Case "importchecktime"
Dim ts As Long = j.GetString
Dim td As Long = File.LastModified(codespath,"codesB.db")
If td > ts Then
Dim result As Int = mymsg.Show("Old File","Imported file is older !",LoadBitmap(File.DirAssets,"Warning-icon.png"),"Load","","Cancel")
If result = DialogResponse.POSITIVE Then import
Else
import
End If
....
end sub
Sub import
Dim j1 As HttpJob
j1.Initialize("download", Me)
j1.download(static & "codesB.db")
End Sub