prep for graphical wrapper

This commit is contained in:
jiahua.liu 2020-03-29 01:07:35 +08:00
parent 4d304ba1ac
commit 412dc0ac13
2 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,35 @@
/*
* Copyright 2020 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package net.mamoe.mirai.console.graphical
import net.mamoe.mirai.console.pure.MiraiConsoleUIPure
import net.mamoe.mirai.console.MiraiConsole
import tornadofx.launch
import kotlin.concurrent.thread
class MiraiConsoleGraphicalLoader {
companion object {
internal lateinit var coreVersion :String
internal lateinit var consoleVersion: String
@JvmStatic
fun load(
coreVersion: String,
consoleVersion: String
) {
this.coreVersion = coreVersion
this.consoleVersion = consoleVersion
Runtime.getRuntime().addShutdownHook(thread(start = false) {
MiraiConsole.stop()
})
launch<MiraiGraphicalUI>()
}
}
}

View File

@ -27,8 +27,7 @@ class MiraiGraphicalUI : App(Decorator::class, PrimaryStyleSheet::class) {
override fun init() {
super.init()
MiraiConsole.start(find<MiraiGraphicalUIController>())
MiraiConsole.start(find<MiraiGraphicalUIController>(),MiraiConsoleGraphicalLoader.coreVersion,MiraiConsoleGraphicalLoader.consoleVersion)
}
override fun stop() {