zhangzengfei
2023-09-01 3c00b78116b561186876eac1f8589366a347a981
gui/gui.go
@@ -1,15 +1,12 @@
package gui
import (
   "kingdee-dbapi/logger"
   "kingdee-dbapi/nsqclient"
   "strings"
   "kingdee-dbapi/config"
   "kingdee-dbapi/kingdee"
   "kingdee-dbapi/report"
   "kingdee-dbapi/logger"
   "kingdee-dbapi/static"
   "kingdee-dbapi/webserver"
   "fyne.io/fyne/v2"
   "fyne.io/fyne/v2/app"
@@ -25,8 +22,9 @@
   FullScreen bool
}
func NewDisplay() *Display {
func NewDisplay(dbConnectedChan chan bool) *Display {
   a := app.New()
   // 设置图标
   a.SetIcon(static.IconPng)
@@ -65,6 +63,7 @@
      //   //myWindow.Close()
      //},
   }
   var submitBtn *widget.Button
   submitBtn = widget.NewButtonWithIcon("启动", theme.MailSendIcon(), func() {
      config.Options.WebPort = strings.Trim(serverPort.Text, " ")
@@ -80,22 +79,13 @@
      if err != nil {
         logger.Error("db init error:%s", err.Error())
         dialog.ShowError(err, w)
         if !config.Options.Debug {
            return
         }
      }
      form.Disable()
      submitBtn.Text = "已启动"
      submitBtn.Disable()
      report.StartReport()
      // 开启订阅
      go nsqclient.InitNsqConsumer(config.Options.QueryTopic, "sensor01", kingdee.QueryMsgHandle)
      go webserver.Serve(serverPort.Text)
      dbConnectedChan <- true
   })
   content := container.New(layout.NewGridWrapLayout(fyne.NewSize(300, 200)), form)