1234567891011121314151617181920212223242526 |
- Public Class SYS_UPDATE
- Private Sub SYS_UPDATE_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Dim pProcess1() As Process = System.Diagnostics.Process.GetProcessesByName("YS-ERP-SYS.exe")
- For Each p As Process In pProcess1 : p.Kill() : Next
- Dim Strs As String = Application.StartupPath : 資料數 = 6
- MyModule1.進度條() : Target = "https://gcm-smart.com/ERP/YS-ERP/"
- End Sub
- Private Sub SYS_UPDATE_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
- MyModule1.進度條() : Delay(30000)
- MyModule1.進度條() : Dim Str As String = Application.StartupPath
- If IO.File.Exists(Str + "\DotNetBarcode.dll") Then : Else
- MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & "DotNetBarcode.dll", Str + "\DotNetBarcode.dll")
- End If
- MyModule1.進度條() : If IO.File.Exists(Str + "\YS-ERP-SYS.exe") Then : IO.File.Delete(Str + "\YS-ERP-SYS.exe") : End If
- MyModule1.進度條() : My.Computer.Network.DownloadFile(Target & "YS-ERP-SYS.exe", Str + "\YS-ERP-SYS.exe")
- MyModule1.進度條() : Shell(Str + "\YS-ERP-SYS.exe", vbNormalFocus)
- Me.Close()
- End Sub
- Public Sub Delay(ByRef Interval As Double) 'Interval单位为毫秒
- Dim time As DateTime = DateTime.Now
- Dim Span As Double = Interval * 1234
- While ((DateTime.Now.Ticks - time.Ticks) < Span)
- Application.DoEvents()
- End While
- End Sub
- End Class
|