-
Notifications
You must be signed in to change notification settings - Fork 0
/
about.go
126 lines (115 loc) · 2.46 KB
/
about.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package main
import (
"github.com/astaxie/beego/logs"
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
"os/exec"
)
func OpenBrowserWeb(url string) {
cmd := exec.Command("rundll32","url.dll,FileProtocolHandler", url)
err := cmd.Run()
if err != nil {
logs.Error("run cmd fail, %s", err.Error())
}
}
var image1 walk.Image
var image2 walk.Image
func LoadImage(name string) walk.Image {
body, err := BoxFile().Bytes(name)
if err != nil {
logs.Error(err.Error())
return nil
}
file := DEFAULT_HOME + "\\" + name
err = SaveToFile(file, body)
if err != nil {
logs.Error(err.Error())
return nil
}
image, err := walk.NewImageFromFile(file)
if err != nil {
logs.Error(err.Error())
return nil
}
return image
}
func AboutAction() {
var ok *walk.PushButton
var about *walk.Dialog
var err error
if image1 == nil {
image1 = LoadImage("sponsor1.jpg")
}
if image2 == nil {
image2 = LoadImage("sponsor2.jpg")
}
_, err = Dialog{
AssignTo: &about,
Title: LangValue("about"),
Icon: walk.IconInformation(),
MinSize: Size{Width: 300, Height: 200},
DefaultButton: &ok,
Layout: VBox{},
Children: []Widget{
TextLabel{
Text: LangValue("aboutcontext"),
MinSize: Size{Width: 250, Height: 200},
MaxSize: Size{Width: 290, Height: 400},
},
Label{
Text: LangValue("version") + ": "+ VersionGet(),
TextAlignment: AlignCenter,
},
VSpacer{
MinSize: Size{Height: 10},
},
Label{
Text: LangValue("sponsor"),
TextAlignment: AlignCenter,
},
Composite{
Layout: HBox{},
Children: []Widget{
HSpacer{
MinSize: Size{Width: 10},
},
ImageView{
ToolTipText: LangValue("alipay"),
Image: image1,
MaxSize: Size{80, 80},
},
HSpacer{
MinSize: Size{Width: 10},
},
ImageView{
ToolTipText: LangValue("wecartpay"),
Image: image2,
MaxSize: Size{80, 80},
},
HSpacer{
MinSize: Size{Width: 10},
},
},
},
PushButton{
Text: "paypal.me",
OnClicked: func() {
OpenBrowserWeb("https://paypal.me/lixiangyun")
},
},
PushButton{
Text: LangValue("officialweb"),
OnClicked: func() {
OpenBrowserWeb("https://github.com/easymesh/autoproxy-windows")
},
},
PushButton{
Text: LangValue("accpet"),
OnClicked: func() { about.Cancel() },
},
},
}.Run(mainWindow)
if err != nil {
logs.Error(err.Error())
}
}