framework.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. ******************************************************************************
  3. * @file framework.go
  4. * @author MakerYang
  5. ******************************************************************************
  6. */
  7. package Framework
  8. import (
  9. "cnc/framework/config"
  10. "cnc/framework/windows/start"
  11. "embed"
  12. "fmt"
  13. "github.com/gookit/color"
  14. "github.com/wailsapp/wails/v2"
  15. "github.com/wailsapp/wails/v2/pkg/options"
  16. "github.com/wailsapp/wails/v2/pkg/options/assetserver"
  17. "github.com/wailsapp/wails/v2/pkg/options/linux"
  18. "github.com/wailsapp/wails/v2/pkg/options/windows"
  19. )
  20. func Init(template embed.FS, version embed.FS) {
  21. Config.Init(version)
  22. start := StartWindows.Init()
  23. err := wails.Run(&options.App{
  24. Title: "",
  25. Width: 1200,
  26. Height: 768,
  27. MinWidth: 1200,
  28. MinHeight: 768,
  29. AssetServer: &assetserver.Options{
  30. Assets: template,
  31. },
  32. BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 1},
  33. OnStartup: start.Startup,
  34. OnShutdown: start.Shutdown,
  35. Bind: []interface{}{
  36. start,
  37. },
  38. WindowStartState: options.Normal,
  39. Windows: &windows.Options{
  40. WebviewDisableRendererCodeIntegrity: true,
  41. DisableWindowIcon: true,
  42. },
  43. Linux: &linux.Options{
  44. Icon: []byte(""),
  45. WindowIsTranslucent: false,
  46. WebviewGpuPolicy: linux.WebviewGpuPolicyNever,
  47. },
  48. Debug: options.Debug{
  49. OpenInspectorOnStartup: false,
  50. },
  51. })
  52. if err != nil {
  53. fmt.Println("[desktop][framework]:" + color.Gray.Text(err.Error()))
  54. }
  55. }