I have a Xaml.Forms app that uses FreshMVVM. I open a certain page from app.xaml.cs like this:
Xamarin.Forms.Device.BeginInvokeOnMainThread(async () =>
{
var navService = FreshIOC.Container.Resolve<IFreshNavigationService>(FreshMvvm.Constants.DefaultNavigationServiceName);
Page page = FreshPageModelResolver.ResolvePageModel<SomePageModel>();
await navService.PushPage(page, null);
...
});
But I need to add a check to prevent doing this if this page is already open. How can I make such a check?
Add a static bool value in the App class to check if the page has been opened:
And in the page's OnDisappearing method, set the
isPageOpenedto false: