mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
refactor(app): 重构应用控制逻辑并修正部分功能
-移除了 App.shutdown 方法中的 runtime.Quit 调用 - 将 runtime.Show 替换为 runtime.WindowShow - 在全屏菜单项中移除了 MenuItem.Hide 调用 - 将 runtime.Hide替换为 runtime.WindowHide
This commit is contained in:
parent
88aa793774
commit
b764770729
3
app.go
3
app.go
@ -82,7 +82,6 @@ func (a *App) beforeClose(ctx context.Context) (prevent bool) {
|
|||||||
func (a *App) shutdown(ctx context.Context) {
|
func (a *App) shutdown(ctx context.Context) {
|
||||||
// Perform your teardown here
|
// Perform your teardown here
|
||||||
systray.Quit()
|
systray.Quit()
|
||||||
runtime.Quit(ctx)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Greet returns a greeting for the given name
|
// Greet returns a greeting for the given name
|
||||||
@ -159,7 +158,7 @@ func onReady(a *App) {
|
|||||||
//systray.Quit()
|
//systray.Quit()
|
||||||
case <-show.ClickedCh:
|
case <-show.ClickedCh:
|
||||||
logger.SugaredLogger.Infof("显示应用程序")
|
logger.SugaredLogger.Infof("显示应用程序")
|
||||||
runtime.Show(a.ctx)
|
runtime.WindowShow(a.ctx)
|
||||||
//runtime.WindowShow(a.ctx)
|
//runtime.WindowShow(a.ctx)
|
||||||
//case <-hide.ClickedCh:
|
//case <-hide.ClickedCh:
|
||||||
// logger.SugaredLogger.Infof("隐藏应用程序")
|
// logger.SugaredLogger.Infof("隐藏应用程序")
|
||||||
|
3
main.go
3
main.go
@ -64,7 +64,6 @@ func main() {
|
|||||||
FileMenu.AddSeparator()
|
FileMenu.AddSeparator()
|
||||||
FileMenu.AddText("窗口全屏", keys.CmdOrCtrl("f"), func(callback *menu.CallbackData) {
|
FileMenu.AddText("窗口全屏", keys.CmdOrCtrl("f"), func(callback *menu.CallbackData) {
|
||||||
runtime.WindowFullscreen(app.ctx)
|
runtime.WindowFullscreen(app.ctx)
|
||||||
callback.MenuItem.Hide()
|
|
||||||
})
|
})
|
||||||
FileMenu.AddText("窗口还原", keys.Key("Esc"), func(callback *menu.CallbackData) {
|
FileMenu.AddText("窗口还原", keys.Key("Esc"), func(callback *menu.CallbackData) {
|
||||||
runtime.WindowUnfullscreen(app.ctx)
|
runtime.WindowUnfullscreen(app.ctx)
|
||||||
@ -72,7 +71,7 @@ func main() {
|
|||||||
|
|
||||||
if goruntime.GOOS == "windows" {
|
if goruntime.GOOS == "windows" {
|
||||||
FileMenu.AddText("隐藏到托盘区", keys.CmdOrCtrl("h"), func(_ *menu.CallbackData) {
|
FileMenu.AddText("隐藏到托盘区", keys.CmdOrCtrl("h"), func(_ *menu.CallbackData) {
|
||||||
runtime.Hide(app.ctx)
|
runtime.WindowHide(app.ctx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user