Uno: Please implement the Dispatcher

Created on 29 Jul 2018  路  5Comments  路  Source: unoplatform/uno

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?

question

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.

All 5 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ali-YousefiTelori picture Ali-YousefiTelori  路  4Comments

jeromelaban picture jeromelaban  路  3Comments

bricelam picture bricelam  路  3Comments

MelbourneDeveloper picture MelbourneDeveloper  路  3Comments

JanabiSoft picture JanabiSoft  路  4Comments