diff options
Diffstat (limited to 'ui/ui.go')
-rw-r--r-- | ui/ui.go | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -7,15 +7,16 @@ package ui import ( "fmt" + "os" + "runtime" + "time" + "github.com/lxn/walk" "github.com/lxn/win" "golang.zx2c4.com/wireguard/windows/conf" "golang.zx2c4.com/wireguard/windows/ringlogger" "golang.zx2c4.com/wireguard/windows/service" "golang.zx2c4.com/wireguard/windows/ui/syntax" - "os" - "runtime" - "time" ) const testInterfaceName = "test" @@ -195,11 +196,7 @@ func RunUI() { quitAction.SetText("Exit") quit = func() { tray.Dispose() - _, err := service.IPCClientQuit(true) - if err != nil { - walk.MsgBox(nil, "Error Exiting WireGuard", fmt.Sprintf("Unable to exit service due to: %s. You may want to stop WireGuard from the service manager.", err), walk.MsgBoxIconError) - os.Exit(1) - } + onQuit() } quitAction.Triggered().Attach(quit) tray.ContextMenu().Actions().Add(quitAction) @@ -293,3 +290,11 @@ func RunUI() { mw.Run() } + +func onQuit() { + _, err := service.IPCClientQuit(true) + if err != nil { + walk.MsgBox(nil, "Error Exiting WireGuard", fmt.Sprintf("Unable to exit service due to: %s. You may want to stop WireGuard from the service manager.", err), walk.MsgBoxIconError) + os.Exit(1) + } +} |