Hi
I would like to have my Application show in the root view after it has been in the background for more than 5 min.
the following code gets called but nothing happens in the UI.
public class App : Application
{
public static App Instance;
private HomeView _HomePage;
private DateTimeOffset _TimeWentToBack;
public App(AppSetup setup)
{
Instance = this;
_HomePage = AppContainer.Container.Resolve<HomeView>();
MainPage = new CustomNavigationPage(_HomePage.GetMainPage())
{
};
}
public async void ClearNavigationAndGoToOverviewPageAsync()
{
var nav = MainPage.Navigation;
await nav.PopToRootAsync();
}
protected override void OnStart()
{
}
protected override void OnSleep()
{
_TimeWentToBack = DateTimeOffset.Now;
}
protected override void OnResume()
{
base.OnResume();
TimeSpan timeSinceLastOpen = DateTimeOffset.Now - _TimeWentToBack;
if (timeSinceLastOpen.TotalMinutes >= 5)
{
ClearNavigationAndGoToOverviewPageAsync();
_HomePage.ReloadData();
}
}
}
Thanks HP