TextureSync/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupViewController.kt

39 lines
1.0 KiB
Kotlin

package org.hso.texturesyncclient.view.startupView
import org.hso.texturesyncclient.controller.RootController
import org.hso.texturesyncclient.view.mainView.MainView
import tornadofx.Controller
class StartupViewController : Controller() {
private val sv = find(StartupView::class)
private val rootc = find(RootController::class)
fun setServerAddress(address: String){
sv.tfServerIP.text = address
sv.tfServerIP.isFocusTraversable = false
}
fun btnConnectAction(name: String) {
sv.labelStatus.text = "Verbinden ..."
sv.tfServerIP.isEditable = false
sv.btnConnect.isDisable = true
sv.spinnerStatus.isVisible = true
runAsync {
rootc.initConnection(name)
} ui {
// reset for later use
sv.spinnerStatus.isVisible = false
sv.labelStatus.text = "Verbindung zum Server einrichten"
sv.tfServerIP.isEditable = true
sv.btnConnect.isDisable = false
sv.tfServerIP.clear()
}
}
}