How to do the processing and keep GUI refreshed using databinding?

前端 未结 7 633
甜味超标
甜味超标 2020-12-09 04:51

History of the problem

This is continuation of my previous question

How to start a thread to keep GUI refreshed?

but since Jon shed new light on th

7条回答
  •  温柔的废话
    2020-12-09 05:40

    You need to disconnect the source of the notifications from the target for the notifications. The way you have it set up now, every time the value changes, you go through an entire refresh cycle (which I believe is blocking your processing function from continuing as well). This is not what you want.

    Provide an Output stream to your processing function which it would use to write its notifications.

    On the monitoring side, attach an input stream to that outputstream and use it as the data source for your UI component. This way there isn't any notification event handling going on at all - the processing is running flat out as fast as it can, outputting monitor data to the output stream you provide. Your monitor UI is simply rendering whatever it receives in the input stream.

    You will need a thread to continuously read from the input stream. If no data is available, then it should block. If it reads some data, it should dump it into the UI.

    Regards,

    Rodney

提交回复
热议问题