From 0c1e773247871305685646dc190c140ddddf3225 Mon Sep 17 00:00:00 2001 From: Shikong <919411476@qq.com> Date: Sun, 23 Jul 2023 01:27:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=B9=E7=AA=97=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frontend/wailsjs/go/dialog/Support.d.ts | 8 ++++++++ .../frontend/wailsjs/go/dialog/Support.js | 16 +++++++++++++++ app/wails/main.go | 3 ++- app/wails/pkg/app/dialog/dialog.go | 20 +++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/app/wails/frontend/wailsjs/go/dialog/Support.d.ts b/app/wails/frontend/wailsjs/go/dialog/Support.d.ts index e4b56b4..03801db 100644 --- a/app/wails/frontend/wailsjs/go/dialog/Support.d.ts +++ b/app/wails/frontend/wailsjs/go/dialog/Support.d.ts @@ -2,4 +2,12 @@ // This file is automatically generated. DO NOT EDIT import {frontend} from '../models'; +export function MessageDialog(arg1:frontend.MessageDialogOptions):Promise; + +export function OpenDirectoryDialog(arg1:frontend.OpenDialogOptions):Promise; + export function OpenFileDialog(arg1:frontend.OpenDialogOptions):Promise; + +export function OpenMultipleFilesDialog(arg1:frontend.OpenDialogOptions):Promise>; + +export function SaveFileDialog(arg1:frontend.SaveDialogOptions):Promise; diff --git a/app/wails/frontend/wailsjs/go/dialog/Support.js b/app/wails/frontend/wailsjs/go/dialog/Support.js index 5d897ca..1dfbab3 100644 --- a/app/wails/frontend/wailsjs/go/dialog/Support.js +++ b/app/wails/frontend/wailsjs/go/dialog/Support.js @@ -2,6 +2,22 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export function MessageDialog(arg1) { + return window['go']['dialog']['Support']['MessageDialog'](arg1); +} + +export function OpenDirectoryDialog(arg1) { + return window['go']['dialog']['Support']['OpenDirectoryDialog'](arg1); +} + export function OpenFileDialog(arg1) { return window['go']['dialog']['Support']['OpenFileDialog'](arg1); } + +export function OpenMultipleFilesDialog(arg1) { + return window['go']['dialog']['Support']['OpenMultipleFilesDialog'](arg1); +} + +export function SaveFileDialog(arg1) { + return window['go']['dialog']['Support']['SaveFileDialog'](arg1); +} diff --git a/app/wails/main.go b/app/wails/main.go index 2177b15..29e8300 100644 --- a/app/wails/main.go +++ b/app/wails/main.go @@ -30,7 +30,8 @@ func main() { Width: 1024, Height: 768, AssetServer: &assetserver.Options{ - Assets: assets, + Assets: assets, + Handler: app.Handler, }, BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 1}, OnStartup: app.Startup, diff --git a/app/wails/pkg/app/dialog/dialog.go b/app/wails/pkg/app/dialog/dialog.go index fe6a713..c7955c7 100644 --- a/app/wails/pkg/app/dialog/dialog.go +++ b/app/wails/pkg/app/dialog/dialog.go @@ -17,3 +17,23 @@ func (s *Support) OpenFileDialog(dialogOptions runtime.OpenDialogOptions) string path, _ := runtime.OpenFileDialog(s.app.Ctx(), dialogOptions) return path } + +func (s *Support) OpenMultipleFilesDialog(dialogOptions runtime.OpenDialogOptions) []string { + path, _ := runtime.OpenMultipleFilesDialog(s.app.Ctx(), dialogOptions) + return path +} + +func (s *Support) OpenDirectoryDialog(dialogOptions runtime.OpenDialogOptions) string { + path, _ := runtime.OpenDirectoryDialog(s.app.Ctx(), dialogOptions) + return path +} + +func (s *Support) SaveFileDialog(dialogOptions runtime.SaveDialogOptions) string { + path, _ := runtime.SaveFileDialog(s.app.Ctx(), dialogOptions) + return path +} + +func (s *Support) MessageDialog(dialogOptions runtime.MessageDialogOptions) string { + path, _ := runtime.MessageDialog(s.app.Ctx(), dialogOptions) + return path +}