Dispatcherprovides services for managing work items on a specific thread. In Avalonia you will usually have only one
Dispatcher, the one that handles the UI thread. Whenever you need to update the UI from a different thread than the UI thread, you need to access the UI thread via the running
Dispatcher.UIThread. You can either use
InvokeAsync, if you want to run a job on the UI thread. Use
Postwhen you just want to start a job, but you don't need to wait for the job to be finished and you don't need the result. If you need to wait for the result, then use
TextBlockwhich shows the result and a
Buttonwhich is used to start our work.