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

AutoSuspendHelper Class

Summary

Helps manage Xamarin.Forms application lifecycle events.
Namespace
ReactiveUI.XamForms
Interfaces
Base Types
  • object
graph BT Type-->Base0["object"] Type-.->Interface0["IEnableLogger"] click Interface0 "/api/Splat/IEnableLogger" Type-.->Interface1["IDisposable"] Type["AutoSuspendHelper"] class Type type-node

Syntax

public class AutoSuspendHelper : IEnableLogger, IDisposable

Remarks

Instantiate this class in order to setup ReactiveUI suspension hooks. Sample usage of AutoSuspendHelper is given by the code snippet below.

 public partial class App : Application
 {
   private readonly AutoSuspendHelper _autoSuspendHelper;

   public App()
   {
     _autoSuspendHelper = new AutoSuspendHelper();
     RxApp.SuspensionHost.CreateNewAppState = () => new MainState();
     RxApp.SuspensionHost.SetupDefaultSuspendResume(new CustomSuspensionDriver());
     _autoSuspendHelper.OnCreate();

     InitializeComponent();
     MainPage = new MainView();
   }

   protected override void OnStart() => _autoSuspendHelper.OnStart();

   protected override void OnResume() => _autoSuspendHelper.OnResume();

   protected override void OnSleep() => _autoSuspendHelper.OnSleep();
 }

Constructors

Name Summary
AutoSuspendHelper() Initializes a new instance of the AutoSuspendHelper class.

Properties

Name Value Summary
UntimelyDemise Subject<Unit>
Gets a subject to indicate whether the application has crashed.
static

Methods

Name Value Summary
Dispose() void
Dispose(bool) void
Disposes of the items inside the class.
OnCreate() void
Call this method in the constructor of your Xamarin.Forms Xamarin.Forms.Application.
OnResume() void
Call this method in Xamarin.Forms.Application.OnResume method override in your Xamarin.Forms Xamarin.Forms.Application.
OnSleep() void
Call this method in Xamarin.Forms.Application.OnSleep method override in your Xamarin.Forms Xamarin.Forms.Application.
OnStart() void
Call this method in Xamarin.Forms.Application.OnStart method override in your Xamarin.Forms Xamarin.Forms.Application.

Extension Methods

Name Value Summary
BindCommand<AutoSuspendHelper, TViewModel, TProp, TControl, TParam>(TViewModel?, Expression<Func<TViewModel, TProp?>>, Expression<Func<AutoSuspendHelper, TControl>>, Expression<Func<TViewModel, TParam?>>, string?) IReactiveBinding<TView, TProp>
Bind a command from the ViewModel to an explicitly specified control on the View.
BindCommand<AutoSuspendHelper, TViewModel, TProp, TControl, TParam>(TViewModel?, Expression<Func<TViewModel, TProp?>>, Expression<Func<AutoSuspendHelper, TControl>>, IObservable<TParam?>, string?) IReactiveBinding<TView, TProp>
Bind a command from the ViewModel to an explicitly specified control on the View.
BindCommand<AutoSuspendHelper, TViewModel, TProp, TControl>(TViewModel?, Expression<Func<TViewModel, TProp?>>, Expression<Func<AutoSuspendHelper, TControl>>, string?) IReactiveBinding<TView, TProp>
Bind a command from the ViewModel to an explicitly specified control on the View.
BindValidation<AutoSuspendHelper, TViewModel, TViewModelProperty, TViewProperty>(TViewModel?, Expression<Func<TViewModel, TViewModelProperty>>, Expression<Func<AutoSuspendHelper, TViewProperty>>, IValidationTextFormatter<string>?) IDisposable
Binds the specified ViewModel property validation to the View property.
BindValidation<AutoSuspendHelper, TViewModel, TViewModelProperty>(TViewModel?, Expression<Func<TViewModel, TViewModelProperty?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
BindValidation<AutoSuspendHelper, TViewModel, TViewModelProperty>(TViewModel?, Expression<Func<TViewModel, TViewModelProperty?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
BindValidation<AutoSuspendHelper, TViewModel, TViewProperty>(TViewModel?, Expression<Func<AutoSuspendHelper, TViewProperty>>, IValidationTextFormatter<string>?) IDisposable
Binds the overall validation of a ViewModel to a specified View property.
BindValidation<AutoSuspendHelper, TViewModel, TViewProperty>(TViewModel?, Expression<Func<TViewModel?, ValidationHelper?>>, Expression<Func<AutoSuspendHelper, TViewProperty>>, IValidationTextFormatter<string>?) IDisposable
Binds a ValidationHelper from a ViewModel to a specified View property.
BindValidation<AutoSuspendHelper, TViewModel>(TViewModel?, Expression<Func<TViewModel?, ValidationHelper?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
BindValidation<AutoSuspendHelper, TViewModel>(TViewModel?, Expression<Func<TViewModel?, ValidationHelper?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
BindValidationEx<AutoSuspendHelper, TViewModel, TViewModelProperty>(TViewModel?, Expression<Func<TViewModel, TViewModelProperty?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
BindValidationEx<AutoSuspendHelper, TViewModel, TViewModelProperty>(TViewModel?, Expression<Func<TViewModel, TViewModelProperty?>>, TextInputLayout, IValidationTextFormatter<string>?) IDisposable
Platform binding to the TextInputLayout.
DisposeWith<AutoSuspendHelper>(CompositeDisposable) T
Ensures the provided disposable is disposed with the specified CompositeDisposable.
InvokeViewModelAction<T>(Action<T>) object
This is a thing I lifted from Prism.
Log<AutoSuspendHelper>() IFullLogger
Call this method to write log entries on behalf of the current class.
From LogHost
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Expression<Func<AutoSuspendHelper, IObservable<T3>?>>, Expression<Func<AutoSuspendHelper, IObservable<T4>?>>, Expression<Func<AutoSuspendHelper, IObservable<T5>?>>, Expression<Func<AutoSuspendHelper, IObservable<T6>?>>, Expression<Func<AutoSuspendHelper, IObservable<T7>?>>, Expression<Func<AutoSuspendHelper, IObservable<T8>?>>, Expression<Func<AutoSuspendHelper, IObservable<T9>?>>, Expression<Func<AutoSuspendHelper, IObservable<T10>?>>, Expression<Func<AutoSuspendHelper, IObservable<T11>?>>, Expression<Func<AutoSuspendHelper, IObservable<T12>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, T10?, T11?, T12?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Expression<Func<AutoSuspendHelper, IObservable<T3>?>>, Expression<Func<AutoSuspendHelper, IObservable<T4>?>>, Expression<Func<AutoSuspendHelper, IObservable<T5>?>>, Expression<Func<AutoSuspendHelper, IObservable<T6>?>>, Expression<Func<AutoSuspendHelper, IObservable<T7>?>>, Expression<Func<AutoSuspendHelper, IObservable<T8>?>>, Expression<Func<AutoSuspendHelper, IObservable<T9>?>>, Expression<Func<AutoSuspendHelper, IObservable<T10>?>>, Expression<Func<AutoSuspendHelper, IObservable<T11>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, T10?, T11?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Expression<Func<AutoSuspendHelper, IObservable<T3>?>>, Expression<Func<AutoSuspendHelper, IObservable<T4>?>>, Expression<Func<AutoSuspendHelper, IObservable<T5>?>>, Expression<Func<AutoSuspendHelper, IObservable<T6>?>>, Expression<Func<AutoSuspendHelper, IObservable<T7>?>>, Expression<Func<AutoSuspendHelper, IObservable<T8>?>>, Expression<Func<AutoSuspendHelper, IObservable<T9>?>>, Expression<Func<AutoSuspendHelper, IObservable<T10>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, T10?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Expression<Func<AutoSuspendHelper, IObservable<T3>?>>, Expression<Func<AutoSuspendHelper, IObservable<T4>?>>, Expression<Func<AutoSuspendHelper, IObservable<T5>?>>, Expression<Func<AutoSuspendHelper, IObservable<T6>?>>, Expression<Func<AutoSuspendHelper, IObservable<T7>?>>, Expression<Func<AutoSuspendHelper, IObservable<T8>?>>, Expression<Func<AutoSuspendHelper, IObservable<T9>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2, T3, T4, T5, T6, T7, T8>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Expression<Func<AutoSuspendHelper, IObservable<T3>?>>, Expression<Func<AutoSuspendHelper, IObservable<T4>?>>, Expression<Func<AutoSuspendHelper, IObservable<T5>?>>, Expression<Func<AutoSuspendHelper, IObservable<T6>?>>, Expression<Func<AutoSuspendHelper, IObservable<T7>?>>, Expression<Func<AutoSuspendHelper, IObservable<T8>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2, T3, T4, T5, T6, T7>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Expression<Func<AutoSuspendHelper, IObservable<T3>?>>, Expression<Func<AutoSuspendHelper, IObservable<T4>?>>, Expression<Func<AutoSuspendHelper, IObservable<T5>?>>, Expression<Func<AutoSuspendHelper, IObservable<T6>?>>, Expression<Func<AutoSuspendHelper, IObservable<T7>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2, T3, T4, T5, T6>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Expression<Func<AutoSuspendHelper, IObservable<T3>?>>, Expression<Func<AutoSuspendHelper, IObservable<T4>?>>, Expression<Func<AutoSuspendHelper, IObservable<T5>?>>, Expression<Func<AutoSuspendHelper, IObservable<T6>?>>, Func<T1?, T2?, T3?, T4?, T5?, T6?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2, T3, T4, T5>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Expression<Func<AutoSuspendHelper, IObservable<T3>?>>, Expression<Func<AutoSuspendHelper, IObservable<T4>?>>, Expression<Func<AutoSuspendHelper, IObservable<T5>?>>, Func<T1?, T2?, T3?, T4?, T5?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2, T3, T4>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Expression<Func<AutoSuspendHelper, IObservable<T3>?>>, Expression<Func<AutoSuspendHelper, IObservable<T4>?>>, Func<T1?, T2?, T3?, T4?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2, T3>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Expression<Func<AutoSuspendHelper, IObservable<T3>?>>, Func<T1?, T2?, T3?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet, T1, T2>(Expression<Func<AutoSuspendHelper, IObservable<T1>?>>, Expression<Func<AutoSuspendHelper, IObservable<T2>?>>, Func<T1?, T2?, TRet>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Observe a observable which is set to a property, and automatically subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
WhenAnyObservable<AutoSuspendHelper, TRet>(Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>, Expression<Func<AutoSuspendHelper, IObservable<TRet>?>>) IObservable<TRet>
Monitor a property that is an observable, and subscribe to the most recent emitted value.
With<AutoSuspendHelper, TKey, TField>(Dictionary<TKey, TField>, IDictionary<TKey, TField>) TBuilder
Adds the specified dictionary to the provided dictionary.