The recording of the first ever ReactiveUI virtual conference is available on our YouTube Channel.

RxApp Class

Summary

The main registration point for common class instances throughout a ReactiveUI application.
Namespace
ReactiveUI
Base Types
  • object
graph BT Type-->Base0["object"] Type["RxApp"] class Type type-node

Syntax

[SuppressMessage("Usage", "CS8618: Non-nullable property is uninitialized", Justification = "Threading magic.")]
public static class RxApp

Remarks

N.B. Why we have this evil global class In a WPF or UWP application, most commands must have the Dispatcher scheduler set, because notifications will end up being run on another thread; this happens most often in a CanExecute observable.Unfortunately, in a Unit Test framework, while the MS Test Unit runner will *set* the Dispatcher (so we can't even use the lack of its presence to determine whether we're in a test runner or not), none of the items queued to it will ever be executed during the unit test. Initially, I tried to plumb the ability to set the scheduler throughout the classes, but when you start building applications on top of that, having to have *every single * class have a default Scheduler property is really irritating, with either default making life difficult. This class also initializes a whole bunch of other stuff, including the IoC container, logging and error handling.

Attributes

Type Description
SuppressMessageAttribute

Fields

Name Constant Value Summary
BigCacheLimit 256
The size of a large cache of items. Often used for the MemoizingMRUCache class.
static
SmallCacheLimit 64
The size of a small cache of items. Often used for the MemoizingMRUCache class.
static

Properties

Name Value Summary
DefaultExceptionHandler IObserver<Exception>
Gets or sets the Observer which signaled whenever an object that has a ThrownExceptions property doesn't Subscribe to that Observable. Use Observer.Create to set up what will happen - the default is to crash the application with an error message.
static
MainThreadScheduler IScheduler
Gets or sets a scheduler used to schedule work items that should be run "on the UI thread". In normal mode, this will be DispatcherScheduler, and in Unit Test mode this will be Immediate, to simplify writing common unit tests.
static
SuppressViewCommandBindingMessage bool
Gets or sets a value indicating whether log messages should be suppressed for command bindings in the view.
static
SuspensionHost ISuspensionHost
Gets or sets the current SuspensionHost, a class which provides events for process lifetime events, especially on mobile devices.
static
TaskpoolScheduler IScheduler
Gets or sets the a the scheduler used to schedule work items to run in a background thread. In both modes, this will run on the TPL Task Pool.
static

Extension Methods

Name Value Summary
InvokeViewModelAction<T>(Action<T>) object
This is a thing I lifted from Prism.