-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
executable file
·57 lines (50 loc) · 1.35 KB
/
main.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
package main
import (
"time"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
// "log"
)
func main() {
DbInit()
a := app.New()
w := a.NewWindow("Game time tracker BY-ZYA")
w.Resize(fyne.NewSize(400, 300))
output := widget.NewLabel("No output")
Mygametime := widget.NewLabel("No time")
Totalgametime := widget.NewLabel("No Totaltime")
entry := widget.NewEntry()
// textArea := widget.NewMultiLineEntry()
form := &widget.Form{
Items: []*widget.FormItem{ // we can specify items in the constructor
{Text: "Process Name:", Widget: entry}},
OnSubmit: func() { // optional, handle form submission
//log.Println("Form submitted:", entry.Text)
Pbool, Pname, _ := isProcessExist(entry.Text + ".exe")
var (
StartTime time.Time
EndTime time.Time
Totaltime time.Duration
)
if Pbool {
output.SetText(Pname + " is running")
AddNewGame(Pname)
} else {
output.SetText(Pname + " is not running")
AddEndTime(Pname)
}
StartTime, EndTime, Totaltime = ShowTime(Pname)
Mygametime.SetText("Start Time:" + StartTime.Format("2006-01-02 15:04:05") + "\nEnd Time:" + EndTime.Format("2006-01-02 15:04:05"))
Totalgametime.SetText("Total Run:" + Totaltime.String())
},
}
w.SetContent(container.NewVBox(
form,
output,
Mygametime,
Totalgametime,
))
w.ShowAndRun()
}