3

I have a C#/WPF/.NET 4.5 app that users will use to open certain files. The app will then go through a lot of motions - read the file, pass it trough a number of plugins and parsers. The files are potentially fairly big (>100MB) so this could take a while. I want to keep the user informed about what is going on in the UI, so in my viewmodel I have some stuff for showing current status and a progress bar.

Now I want to be cool and modern and do this using ReactiveUIs Async command support, which is completely new to me.

For the feedback messages from the load/parse process, what is the best approach? The status message and progress bar val/max values need to be set on the UI thread, pretty basic stuff. Should I implement my data loader as an IObservable, or is it somehow better to do this using for instance the MessageBus component?

Keep in mind that a user might be loading several of these huge files into the app at once, and I want the UI to remain as responsive as possible while the loading is going on.

Examples of how to go about implementing this properly would be hugely appreciated!

Rune Jacobsen
  • 9,907
  • 11
  • 58
  • 75

1 Answers1

3

I checked this with The Master himself (Paul C. Betts) elsewhere, and he told me that the way to handle this would be for the app that displays the progress information to create a Subject<SomeProgressInfo> and pass this to the guys doing the actual loading/parsing. These can then push new information to the host using .OnNext().

This also helps with unit testing, where one can just provide a dummy Subject<T> that won't be subscribed to.

Rune Jacobsen
  • 9,907
  • 11
  • 58
  • 75