Final commit on fixing the Updater behaviour.

This commit is contained in:
jianmingyong 2017-02-17 01:45:21 +08:00
parent b99ff2d2d5
commit f0ee07c20f
2 changed files with 24 additions and 10 deletions

View File

@ -98,19 +98,33 @@ Public Class MainMenuScreen
Catch ex As Exception Catch ex As Exception
End Try End Try
End Sub End Sub
Private Async Function WaitForUpdaterAsync() As Task Private Async Function WaitForUpdaterAsync() As Task
Dim updater As New Process() Dim Updater As New Process
updater.StartInfo = New ProcessStartInfo("Updater.exe") Updater.EnableRaisingEvents = True
updater.Start() Updater.StartInfo = New ProcessStartInfo("Updater.exe")
Updater.Start()
Await Task.Delay(5000) AddHandler Updater.Exited, Sub()
If Not updater.HasExited Then Select Case Updater.ExitCode
updater.Kill() Case 0
End If GameController.UpdateChecked = True
Case 1
If updater.ExitCode = 1 Then Core.GameOptions.UpdateDisabled = True
Core.GameOptions.SaveOptions()
GameController.UpdateChecked = True
Case 2
Core.GameInstance.Exit() Core.GameInstance.Exit()
Else Case 3
Core.GameOptions.UpdateDisabled = True
Core.GameOptions.SaveOptions()
Core.GameInstance.Exit()
End Select
End Sub
Await Task.Delay(20000)
If Not Updater.HasExited Then
Updater.Kill()
GameController.UpdateChecked = True GameController.UpdateChecked = True
End If End If
End Function End Function

Binary file not shown.