This repository was archived by the owner on Sep 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.go
More file actions
72 lines (61 loc) · 1.39 KB
/
main.go
File metadata and controls
72 lines (61 loc) · 1.39 KB
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
package main
import (
"NovaImitation/core/account"
"NovaImitation/core/config"
"NovaImitation/core/network"
"context"
"embed"
"time"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/runtime"
)
// App struct
type App struct {
ctx context.Context
}
// NewApp creates a new App application struct
func NewApp() *App {
return &App{}
}
// startup is called when the app starts. The context is saved
// so we can call the runtime methods
func (a *App) startup(ctx context.Context) {
a.ctx = ctx
}
func (a *App) StartDownload() {
for progress := 10; progress <= 100; progress += 10 {
time.Sleep(time.Second)
runtime.EventsEmit(a.ctx, "download_progress", progress)
}
runtime.EventsEmit(a.ctx, "download_success")
}
//go:embed all:frontend/dist
var assets embed.FS
func main() {
// Create an instance of the app structure
app := NewApp()
// Create application with options
err := wails.Run(&options.App{
Title: "PCL2.Nova.App",
Width: 1024,
Height: 614,
MinWidth: 1024,
MinHeight: 614,
Frameless: true,
AssetServer: &assetserver.Options{
Assets: assets,
},
OnStartup: app.startup,
Bind: []any{
app,
&network.Network{},
&account.AccountBinding{},
&config.ConfigBinding{},
},
})
if err != nil {
println("Error:", err.Error())
}
}