Created
August 5, 2018 12:11
Sending lifecycle method through MessagingCenter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using LifeCycleProblem.Models; | |
using LifeCycleProblem.Views; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Xaml; | |
[assembly: XamlCompilation(XamlCompilationOptions.Compile)] | |
namespace LifeCycleProblem | |
{ | |
public partial class App : Application | |
{ | |
public App() | |
{ | |
InitializeComponent(); | |
MainPage = new MainPage(); | |
} | |
protected override void OnStart() | |
{ | |
MessagingCenter.Send(this, MessageNames.LifeCycle, CycleEventType.OnStart); | |
} | |
protected override void OnSleep() | |
{ | |
MessagingCenter.Send(this, MessageNames.LifeCycle, CycleEventType.OnSleep); | |
} | |
protected override void OnResume() | |
{ | |
MessagingCenter.Send(this, MessageNames.LifeCycle, CycleEventType.OnResume); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment