Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add support to ObserveOn WinUI 3's DispatcherQueue. #1651

Open
kmgallahan opened this issue Nov 24, 2021 · 6 comments
Open

Comments

@kmgallahan
Copy link

Feature request

Which next library version (i.e., patch, minor or major)?

Rx.NET v5.?.?

What are the platform(s), environment(s) and related component version(s)?

Windows / WinUI 3

How commonly is this feature needed (one project, several projects, company-wide, global)?

Anyone using Rx with WinUI 3 would likely find this useful this at some point.

Please describe the feature.

This is a request to add ObserveOn extension method(s) to accept WinUI 3's Microsoft.UI.Dispatching.DispatcherQueue for scheduling.

Might be pertinent to start by introducing a new HAS_WINUI conditional compilation symbol. The Target framework wouldn't work as a differentiator, but every project file must contain <UseWinUI>true</UseWinUI>, so that could work.

@djonasdev
Copy link

@kmgallahan
Copy link
Author

kmgallahan commented Apr 11, 2022

@dojo90 FYI ReactiveUI has a Scheduler implementation for DispatcherQueue now.

https://github.com/reactiveui/ReactiveUI/tree/main/src/ReactiveUI.WinUI

@andrensairr
Copy link

It's nearing the end of 2023 now and all the reading I've done between documentation and GitHub issues for Reactive Extensions, MS.UI.Xaml repo, Windows Runtime SDK does not help me figure out how to observe on my app's dispatcher thread. Trying ObserveOnCoreDispatcher in my WinUI 3 desktop app I encounter the InvalidOperationException "No current Window object found to obtain a CoreDispatcher from." I can't find a scheduler specifically for the DispatcherQueue. Can somebody please explain if this present issue is intended to add support for my use case, and that it is still incomplete? Some improved documentation on all of the relevant technologies here would be immensely helpful but there seems to be a lot of finger pointing between teams.

@kmgallahan
Copy link
Author

@andrensairr
Copy link

Thank you @kmgallahan, that seems to do the trick just fine. Not using ReactiveUI just yet, I've a fair bit of work to do before sorting the finer points of my UI and I wasn't sure how complete the WinUI 3 support in ReactiveUI was just yet.

@kmgallahan
Copy link
Author

@andrensairr I recently decided to stop using ReactiveUI in favor of just System.Reactive & DynamicData. If you aren't developing a cross-plat app, which I was not, then I found the prescriptive nature to be restrictive. I just extracted the most useful bits I was using (DispatcherQueueScheduler, DisposeWith), and switched from WhenAnyValue to the change notifications offered by DynamicData.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants