提交 40fc6939 编写于 作者: yanghye's avatar yanghye

v2.5.1 sys tray Show init

上级 317b3060
......@@ -81,7 +81,7 @@ type CEFTray struct {
//SysTray 系统原生
type SysTray struct {
once sync.Once
lock sync.Mutex
menu *SysMenu
icon []byte
title, tooltip string
......
......@@ -11,6 +11,7 @@ package cef
import (
"github.com/energye/energy/common"
"github.com/energye/energy/consts"
"github.com/energye/energy/logger"
"github.com/energye/energy/pkgs/notice"
"github.com/energye/energy/pkgs/systray"
"github.com/energye/golcl/energy/emfs"
......@@ -92,9 +93,11 @@ func (m *SysTray) AsLCLTray() *LCLTray {
//Show 显示/启动 托盘
func (m *SysTray) Show() {
m.once.Do(func() {
m.lock.Lock()
defer m.lock.Unlock()
if m.start == nil {
var runLoop = func() {
logger.Info("sys tray ready")
m.start, m.stop = systray.RunWithExternalLoop(m.onReady, m.onExit)
m.start()
}
......@@ -113,7 +116,6 @@ func (m *SysTray) Show() {
go runLoop()
}
}
})
}
func (m *SysTray) close() {
......
......@@ -80,7 +80,8 @@ func main() {
if common.IsWindows() {
//支持 windows
//traydemo.LCLCefTrayDemo(window) //对于LCL+CEF web端技术托盘实现无法在VF中使用
traydemo.LCLTrayDemo(window) //LCL托盘, VF窗口组件中无法创建或使用LCL组件
//traydemo.LCLTrayDemo(window) //LCL托盘, VF窗口组件中无法创建或使用LCL组件
traydemo.SysTrayDemo(window) //系统原生托盘,在windows下不如lcl组件的好用, 推荐linux中使用
} else {
//traydemo.SysTrayDemo(window) //系统原生托盘,在windows下不如lcl组件的好用, 推荐linux中使用
//LCL窗口中,托盘组件支持 windows or macosx
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册