Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SYS-UPDATE.vb 1.6KB

12345678910111213141516171819202122232425262728
  1. Imports System.IO
  2. Public Class SYS_UPDATE
  3. ReadOnly ds2 As New DataSet
  4. Private Sub SYS_UPDATE_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  5. Dim pProcess1() As Process = System.Diagnostics.Process.GetProcessesByName("TENDEN-ERP-SYS.exe")
  6. For Each p As Process In pProcess1 : p.Kill() : Next
  7. Dim Strs As String = Application.StartupPath : 資料數 = 17
  8. MyModule1.進度條() : Target = "https://gcm-smart.com/ERP/TENDEN/"
  9. End Sub
  10. Private Sub SYS_UPDATE_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  11. MyModule1.進度條() : Delay(30000)
  12. MyModule1.進度條() : Dim Str As String = Application.StartupPath
  13. MyModule1.進度條() : If File.Exists(Str + "\TENDEN-ERP-SYS.exe") Then : File.Delete(Str + "\TENDEN-ERP-SYS.exe") : End If
  14. If 伺服器區域_cb.Text = "天盾伺服器" Then
  15. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & AA(0) & "/" & "TENDEN-ERP-SYS.exe", Str + "\TENDEN-ERP-SYS.exe")
  16. Else
  17. MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & "TENDEN-ERP-SYS.exe", Str + "\TENDEN-ERP-SYS.exe")
  18. End If
  19. MyModule1.進度條() : Shell(Str + "\TENDEN-ERP-SYS.exe", vbNormalFocus) : Me.Close()
  20. End Sub
  21. Public Sub Delay(ByRef Interval As Double) 'Interval单位为毫秒
  22. Dim time As DateTime = DateTime.Now
  23. Dim Span As Double = Interval * 1234
  24. While ((DateTime.Now.Ticks - time.Ticks) < Span)
  25. Application.DoEvents()
  26. End While
  27. End Sub
  28. End Class