-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathabout.go
115 lines (104 loc) · 2.21 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
package main
import (
"os/exec"
"github.com/astaxie/beego/logs"
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
)
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 aboutContext = ""
var image1 walk.Image
var image2 walk.Image
func AboutAction(mw *walk.MainWindow) {
var ok *walk.PushButton
var about *walk.Dialog
var err error
if aboutContext == "" {
temp, err := BoxFile().String("about.txt")
if err != nil {
logs.Error(err.Error())
}
aboutContext = temp
}
if image1 == nil {
image1 = IconLoadImageFromBox("sponsor1.jpg")
}
if image2 == nil {
image2 = IconLoadImageFromBox("sponsor2.jpg")
}
_, err = Dialog{
AssignTo: &about,
Title: "About",
Icon: walk.IconInformation(),
MinSize: Size{Width: 300, Height: 200},
DefaultButton: &ok,
Layout: VBox{},
Children: []Widget{
TextLabel{
Text: aboutContext,
MinSize: Size{Width: 250, Height: 200},
MaxSize: Size{Width: 290, Height: 400},
},
Label{
Text: "Version: " + VersionGet(),
TextAlignment: AlignCenter,
},
VSpacer{
MinSize: Size{Height: 10},
},
Label{
Text: "Sponsor",
TextAlignment: AlignCenter,
},
Composite{
Layout: HBox{},
Children: []Widget{
HSpacer{
MinSize: Size{Width: 10},
},
ImageView{
ToolTipText: "Ali Pay",
Image: image1,
MaxSize: Size{80, 80},
},
HSpacer{
MinSize: Size{Width: 10},
},
ImageView{
ToolTipText: "Wecart Pay",
Image: image2,
MaxSize: Size{80, 80},
},
HSpacer{
MinSize: Size{Width: 10},
},
},
},
PushButton{
Text: "Paypal.me",
OnClicked: func() {
OpenBrowserWeb("https://www.paypal.com/paypalme/lixiangyun")
},
},
PushButton{
Text: "Official Web",
OnClicked: func() {
OpenBrowserWeb("https://github.com/linimbus/tcpproxy-windows")
},
},
PushButton{
Text: "OK",
OnClicked: func() { about.Cancel() },
},
},
}.Run(mw)
if err != nil {
logs.Error(err.Error())
}
}