Author:水如烟  

Public Class RestartProgramService

    
Private Shared gAppLocation As String

    
Public Shared Sub Run()
        
AddHandler AppDomain.CurrentDomain.ProcessExit, AddressOf AppDomain_ProcessExit
        gAppLocation 
= Reflection.Assembly.GetEntryAssembly.Location
        System.Diagnostics.Process.GetCurrentProcess.CloseMainWindow()
    
End Sub

    
Private Shared Sub AppDomain_ProcessExit(ByVal sender As ObjectByVal e As System.EventArgs)
        System.Diagnostics.Process.Start(gAppLocation)
    
End Sub

End Class

可怜,我居然不知道已有Application.Restart这玩意儿.

相关文章:

  • 2022-12-23
  • 2021-08-30
  • 2021-07-17
  • 2021-10-02
  • 2022-01-05
  • 2022-12-23
  • 2021-10-29
  • 2021-07-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2022-01-12
  • 2021-10-30
相关资源
相似解决方案