Skip to content

Commit

Permalink
Merge pull request #100 from obsti8383/master
Browse files Browse the repository at this point in the history
fix bug in command line version (wanted to open GUI dialog)
  • Loading branch information
botherder committed Apr 6, 2021
2 parents d7a18ea + c402004 commit ad954a8
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,26 +237,36 @@ func createMainGUIContent(elevationStatus bool) {

// showErrorDialog shows an error message.
func showErrorDialog(errorMessage string) {
ch := make(chan bool)
err := errors.New(errorMessage)
errorDialog := dialog.NewError(err, mainWindow)
errorDialog.SetOnClosed(func() {
ch <- true
})
errorDialog.Show()
<-ch
if mainWindow != nil {
ch := make(chan bool)
err := errors.New(errorMessage)
errorDialog := dialog.NewError(err, mainWindow)
errorDialog.SetOnClosed(func() {
ch <- true
})
errorDialog.Show()
<-ch
} else {
// no main windows - seem to be in command line mode.
Info.Println("Error: " + errorMessage)
}

}

// showInfoDialog shows an info message.
func showInfoDialog(infoMessage string) {
ch := make(chan bool)
infoDialog := dialog.NewInformation("Information", infoMessage, mainWindow)
infoDialog.SetOnClosed(func() {
ch <- true
})
infoDialog.Show()
<-ch

if mainWindow != nil {
ch := make(chan bool)
infoDialog := dialog.NewInformation("Information", infoMessage, mainWindow)
infoDialog.SetOnClosed(func() {
ch <- true
})
infoDialog.Show()
<-ch
} else {
// no main windows - seem to be in command line mode.
Info.Println("Information: " + infoMessage)
}
}

// showEndDialog shows the close button after hardening/restoring.
Expand Down

0 comments on commit ad954a8

Please sign in to comment.