My existing code base has lots of references to CoreApplication.MainView.CoreWindow.Dispatcher, which shows up as "not implemented in UNO".
Any chance to get this implemented soon? Or is there a suitable alternative for an UI thead dispatcher that works with Uno?
CoreDispatcher is already implemented so we can certainly add support for this property.
For now the nearest equivalent property would be Window.Current.Dispatcher.
This is indeed an easy addition, though CoreApplication is a bit more complex to add. I've made a PR to add CoreWindow.Dispatcher, since it can be accessed from other locations, and it will make it easier to port code, but not through CoreApplication.MainView yet.
Sounds good... but unfortunately seems to be no solution for my library code.
Window.Current is null and CoreWindow does not have GetForCurrentThread() implemented yet. So I am still not sure how I should reach some suitable Dispatcher. :(
Window.Current is null
Is it null under Uno or under Windows ? Under Uno, Window.Current always returns an instance whereas on windows, it returns a window if the current thread is a UI thread.
Ah, good to know, just tried it quickly under Windows.
So I will probably add a conditional or a platform-specific preprocessor directive.
Thanks!
Most helpful comment
CoreDispatcher is already implemented so we can certainly add support for this property.
For now the nearest equivalent property would be Window.Current.Dispatcher.