Browse Source

新增处理方法

master
viviman 3 years ago
parent
commit
eaec1dc00a
  1. 2
      golang_learn/data_func/go_to_tray/demo01/main.go
  2. 1
      golang_learn/data_func/go_to_tray/demo04/.keepgit
  3. 7
      golang_learn/data_func/go_to_tray/demo04/build.bat
  4. 3
      golang_learn/data_func/go_to_tray/demo04/build.sh
  5. 55
      golang_learn/data_func/go_to_tray/demo04/main.go
  6. BIN
      golang_learn/data_func/go_to_tray/demo04/main.ico
  7. 22
      golang_learn/data_func/go_to_tray/demo04/main.manifest
  8. BIN
      golang_learn/data_func/go_to_tray/demo04/main.syso
  9. 1
      golang_learn/data_func/go_to_tray/demo04/shell/closeCX.bat
  10. 1
      golang_learn/data_func/go_to_tray/demo04/shell/closeCX.sh
  11. 1
      golang_learn/data_func/go_to_tray/demo04/shell/closeDB.bat
  12. 1
      golang_learn/data_func/go_to_tray/demo04/shell/closeDB.sh
  13. 1
      golang_learn/data_func/go_to_tray/demo04/shell/startCX.bat
  14. 1
      golang_learn/data_func/go_to_tray/demo04/shell/startCX.sh
  15. 1
      golang_learn/data_func/go_to_tray/demo04/shell/startDB.bat
  16. 1
      golang_learn/data_func/go_to_tray/demo04/shell/startDB.sh

2
golang_learn/data_func/go_to_tray/demo01/main.go

@ -20,7 +20,7 @@ func main() {
func onReady() {
timezone = "默认文字"
systray.SetIcon(getIcon("D:\\ViviCode\\golangs_learn\\golang_learn\\data_func\\go_to_tray\\demo01\\icon.ico"))
systray.SetIcon(getIcon("/Users/zhangxianwei/GolandProjects/golangs_learn/golang_learn/data_func/go_to_tray/demo01/icon.ico"))
submenu := systray.AddSubMenu("子菜单")
_ = submenu.AddSubMenuItem("开始", "", 0)

1
golang_learn/data_func/go_to_tray/demo04/.keepgit

@ -1 +0,0 @@
增加版本控制

7
golang_learn/data_func/go_to_tray/demo04/build.bat

@ -0,0 +1,7 @@
set GO111MODULE=on
SET CGO_ENABLED=0
set GOARCH=386
set GOOS=windows
rsrc -manifest main.manifest -ico main.ico -o main.syso
go generate
go build -ldflags="-s -w -H=windowsgui" -o 꽉데으-頓契솰왠.exe

3
golang_learn/data_func/go_to_tray/demo03/run.bat → golang_learn/data_func/go_to_tray/demo04/build.sh

@ -1,6 +1,5 @@
set GO111MODULE=on
SET CGO_ENABLED=0
set GOARCH=arm
set GOARCH=amd
set GOOS=linux
rsrc -manifest main.manifest -ico main.ico -o main.syso
go generate

55
golang_learn/data_func/go_to_tray/demo04/main.go

@ -0,0 +1,55 @@
package main
import (
"fmt"
"github.com/riftbit/go-systray"
"io/ioutil"
)
var (
timezone string
)
func main() {
systray.Run(onReady, onExit)
}
func onReady() {
timezone = "公务员"
_ = systray.SetIcon(getIcon("/Users/zhangxianwei/GolandProjects/golangs_learn/golang_learn/data_func/go_to_tray/demo01/icon.ico"))
submenu := systray.AddSubMenu("子菜单")
_ = submenu.AddSubMenuItem("开始", "", 0)
_ = submenu.AddSubMenuItem("结束", "", 0)
localTime := systray.AddMenuItem("炎龙", "炎龙", 0)
fmt.Printf("%#v", localTime)
systray.AddSeparator()
mQuit := systray.AddMenuItem("退出", "退出", 0)
go func() {
for {
select {
case <-localTime.OnClickCh():
timezone = "炎龙"
case <-mQuit.OnClickCh():
systray.Quit()
return
}
}
}()
}
func onExit() {
// 清除销毁
}
func getIcon(s string) []byte {
b, err := ioutil.ReadFile(s)
if err != nil {
fmt.Print(err)
}
return b
}

BIN
golang_learn/data_func/go_to_tray/demo04/main.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

22
golang_learn/data_func/go_to_tray/demo04/main.manifest

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="SomeFunkyNameHere" type="win32"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>
</windowsSettings>
</application>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

BIN
golang_learn/data_func/go_to_tray/demo04/main.syso

Binary file not shown.

1
golang_learn/data_func/go_to_tray/demo04/shell/closeCX.bat

@ -0,0 +1 @@
net stop GWY20_Tomcat

1
golang_learn/data_func/go_to_tray/demo04/shell/closeCX.sh

@ -0,0 +1 @@
net start GWY20_Mysql

1
golang_learn/data_func/go_to_tray/demo04/shell/closeDB.bat

@ -0,0 +1 @@
net stop GWY20_Mysql

1
golang_learn/data_func/go_to_tray/demo04/shell/closeDB.sh

@ -0,0 +1 @@
net start GWY20_Mysql

1
golang_learn/data_func/go_to_tray/demo04/shell/startCX.bat

@ -0,0 +1 @@
net start GWY20_Tomcat

1
golang_learn/data_func/go_to_tray/demo04/shell/startCX.sh

@ -0,0 +1 @@
net start GWY20_Mysql

1
golang_learn/data_func/go_to_tray/demo04/shell/startDB.bat

@ -0,0 +1 @@
net start GWY20_Mysql

1
golang_learn/data_func/go_to_tray/demo04/shell/startDB.sh

@ -0,0 +1 @@
net start GWY20_Mysql
Loading…
Cancel
Save