mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-06-28 05:25:11 +00:00
Find view: confirm deletion (fixes #58)
This commit is contained in:
@ -141,3 +141,28 @@ func (a *App) ReportSharedStateVariable(key, value string) {
|
||||
a.State.Store(key, value)
|
||||
wailsRuntime.LogDebug(a.ctx, fmt.Sprintf("State: %s=\"%s\"", key, value))
|
||||
}
|
||||
|
||||
func (a *App) AskConfirmation(message string) bool {
|
||||
var title string = ""
|
||||
if runtime.GOOS == "darwin" {
|
||||
title = message
|
||||
message = ""
|
||||
} else {
|
||||
title = "Confirm"
|
||||
}
|
||||
|
||||
button, err := wailsRuntime.MessageDialog(a.ctx, wailsRuntime.MessageDialogOptions{
|
||||
Type: wailsRuntime.QuestionDialog,
|
||||
Title: title,
|
||||
Message: message,
|
||||
Buttons: []string{"Yes", "No"},
|
||||
DefaultButton: "Yes",
|
||||
CancelButton: "No",
|
||||
})
|
||||
|
||||
if err == nil {
|
||||
return button == "Yes"
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user