``` fun loadExistingConfiguration(events: Obse...
# tornadofx
b
Copy code
fun loadExistingConfiguration(events: Observable<ActionEvent>) {
        events.subscribeOnFx()
                .doOnNext {
                    logger.debug("Event received from button!")
                    //TODO: indicate loading!
                    //Event received
                    configSections.clear()
                }
                .subscribeOn(<http://Schedulers.io|Schedulers.io>())
                .flatMap {
                    //load teh file and emit all the sections
                    val home = System.getProperty("user.home")
                    val config = SSHConfigFile(Paths.get(home, ".ssh", "config")) //TODO: turn this into a proper configurable value
                    config.sections.toObservable()
                }
                .subscribeOnFx()
                .doOnNext {
                    configSections.add(ViewConfigSection(it))
                }
                .subscribe()
    }