Exemplo n.º 1
0
func main() {

	var dir string
	//dir := C.GoString(C.getenv(C.CString("FILESDIR")))
	if runtime.GOOS == "android" {
		dir = get_files_dir.GetFilesDir()
	} else {
		dir = *utils.Dir
	}
	fmt.Println("dir::", dir)

	go dcoin.Start(dir, nil)

	app.Main(func(a app.App) {

		for e := range a.Events() {
			fmt.Println("e:", e)
			switch e := app.Filter(e).(type) {
			case size.Event:
				cfg = e
			case paint.Event:
				onPaint(cfg)
				a.EndPaint(e)
			}
		}
	})
}
Exemplo n.º 2
0
func main() {

	runtime.LockOSThread()

	var width uint = 800
	var height uint = 600
	var thrustWindow *window.Window
	if runtime.GOOS == "darwin" {
		height = 578
	}
	if utils.Desktop() && (winVer() >= 6 || winVer() == 0) {
		thrust.Start()
		thrustWindow = thrust.NewWindow(thrust.WindowOptions{
			RootUrl:  "http://localhost:8989/loader.html",
			HasFrame: true,
			Title:    "Dcoin",
			Size:     commands.SizeHW{Width: width, Height: height},
		})

		thrust.NewEventHandler("*", func(cr commands.CommandResponse) {
			//fmt.Println(fmt.Sprintf("======Event(%s %d) - Signaled by Command (%s)", cr.TargetID, cr.Type))
			if cr.TargetID > 1 && cr.Type == "closed" {
				if utils.DB != nil && utils.DB.DB != nil {
					utils.DB.ExecSql(`INSERT INTO stop_daemons(stop_time) VALUES (?)`, utils.Time())
				} else {
					thrust.Exit()
					os.Exit(0)
				}
			}
		})
		thrustWindow.Show()
		thrustWindow.Focus()
		go func() {
			http.HandleFunc("/static/img/main_loader.gif", main_loader)
			http.HandleFunc("/loader.html", main_loader_html)
			http.ListenAndServe(":8989", nil)
		}()
	}
	tray()

	go dcoin.Start("", thrustWindow)

	enterLoop()

}
Exemplo n.º 3
0
//export dcoinStart
func dcoinStart() {
	go dcoin.Start(C.GoString(C.GetFilesDir()), nil)
}