Class AutoSuspendHelper
- Namespace
- ReactiveUI.Maui
- Assembly
- ReactiveUI.Maui.dll
Helps manage Xamarin.Forms application lifecycle events.
public class AutoSuspendHelper : IEnableLogger, IDisposable
- Inheritance
-
AutoSuspendHelper
- Implements
- Extension Methods
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
AutoSuspendHelper()
Initializes a new instance of the AutoSuspendHelper class.
public AutoSuspendHelper()
Properties
UntimelyDemise
Gets a subject to indicate whether the application has crashed.
public static Subject<Unit> UntimelyDemise { get; }
Property Value
- Subject<Unit>
Methods
Dispose()
public void Dispose()
Dispose(bool)
Disposes of the items inside the class.
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolIf we are disposing of managed objects or not.
OnCreate()
Call this method in the constructor of your Xamarin.Forms Microsoft.Maui.Controls.Application.
public void OnCreate()
OnResume()
Call this method in Microsoft.Maui.Controls.Application.OnResume method override in your Xamarin.Forms Microsoft.Maui.Controls.Application.
public void OnResume()
OnSleep()
Call this method in Microsoft.Maui.Controls.Application.OnSleep method override in your Xamarin.Forms Microsoft.Maui.Controls.Application.
public void OnSleep()
OnStart()
Call this method in Microsoft.Maui.Controls.Application.OnStart method override in your Xamarin.Forms Microsoft.Maui.Controls.Application.
public void OnStart()