ready for rpa

This commit is contained in:
ctengiz
2024-03-26 10:55:22 +03:00
parent 465aae3710
commit f2939d6c4d
17 changed files with 1362 additions and 90 deletions

View File

@@ -2,13 +2,11 @@ package main
import (
"bordrobot/lib/company"
"bordrobot/lib/db"
"bordrobot/lib/dbsrv"
"bordrobot/lib/run"
"bordrobot/lib/srv"
"embed"
"log"
"time"
"github.com/wailsapp/wails/v3/pkg/application"
"log"
)
// Wails uses Go's `embed` package to embed the frontend files into the binary.
@@ -25,7 +23,7 @@ var assets embed.FS
func main() {
//Init SqLite database
err := db.InitDB(".")
err := run.InitDB(".")
if err != nil {
log.Fatal(err)
}
@@ -35,12 +33,12 @@ func main() {
// 'Assets' configures the asset server with the 'FS' variable pointing to the frontend files.
// 'Bind' is a list of Go struct instances. The frontend has access to the methods of these instances.
// 'Mac' options tailor the application when running an macOS.
app := application.New(application.Options{
run.APP = application.New(application.Options{
Name: "bordro-robotu",
Description: "A demo of using raw HTML & CSS",
Bind: []any{
&company.Company{},
&dbsrv.Srv{},
&srv.Srv{},
},
Assets: application.AssetOptions{
Handler: application.AssetFileServerFS(assets),
@@ -55,7 +53,7 @@ func main() {
// 'Mac' options tailor the window when running on macOS.
// 'BackgroundColour' is the background colour of the window.
// 'URL' is the URL that will be loaded into the webview.
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
run.APP.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Luca Bordro Robotu",
Mac: application.MacWindow{
InvisibleTitleBarHeight: 50,
@@ -66,20 +64,8 @@ func main() {
URL: "/",
})
// Create a goroutine that emits an event containing the current time every second.
// The frontend can listen to this event and update the UI accordingly.
go func() {
for {
now := time.Now().Format(time.RFC1123)
app.Events.Emit(&application.WailsEvent{
Name: "time",
Data: now,
})
time.Sleep(time.Second)
}
}()
// Run the application. This blocks until the application has been exited.
err = app.Run()
err = run.APP.Run()
// If an error occurred while running the application, log it and exit.
if err != nil {