init
This commit is contained in:
64
main.go
Normal file
64
main.go
Normal file
@@ -0,0 +1,64 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"github.com/wailsapp/wails/v2/pkg/logger"
|
||||
"log"
|
||||
|
||||
"equipment-analyzer/internal/config"
|
||||
"equipment-analyzer/internal/service"
|
||||
"equipment-analyzer/internal/utils"
|
||||
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
)
|
||||
|
||||
//go:embed frontend/dist
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
// 初始化日志
|
||||
newLogger := utils.NewLogger()
|
||||
defer newLogger.Sync()
|
||||
|
||||
// 加载配置
|
||||
cfg, err := config.Load()
|
||||
if err != nil {
|
||||
log.Fatal("Failed to load config:", err)
|
||||
}
|
||||
|
||||
// 创建应用服务
|
||||
app := service.NewApp(cfg, newLogger)
|
||||
|
||||
// 设置应用选项
|
||||
appOptions := &options.App{
|
||||
|
||||
Title: "epic-luna",
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
//Hidden: false,
|
||||
BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 1},
|
||||
Assets: assets,
|
||||
Menu: nil,
|
||||
Logger: nil,
|
||||
LogLevel: logger.DEBUG,
|
||||
LogLevelProduction: logger.ERROR,
|
||||
OnStartup: app.Startup,
|
||||
OnDomReady: app.DomReady,
|
||||
OnBeforeClose: app.BeforeClose,
|
||||
OnShutdown: app.Shutdown,
|
||||
Debug: options.Debug{
|
||||
OpenInspectorOnStartup: true,
|
||||
},
|
||||
//EnableDefaultContext: true,
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
}
|
||||
|
||||
// 启动应用
|
||||
err = wails.Run(appOptions)
|
||||
if err != nil {
|
||||
log.Fatal("Failed to start application:", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user