Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class NavigationPageU : NavigationPage
{
public NavigationPageU(){}
//Implements initial page in constructor
public NavigationPageU(Page p) => Task.Run(() => { PushAsync(p); });
public new Task PushAsync(Page page,bool animated = false)
{
if (Navigation.NavigationStack.Count > 0 && (page.GetType() == Navigation.NavigationStack.Last().GetType()))
{
return Task.FromResult(false);
}
return base.PushAsync(page, animated);
}
public Task PushModalAsync(Page page, bool animated)
{
if (Navigation.NavigationStack.Count > 0 && (page.GetType() == Navigation.NavigationStack.Last().GetType()))
{
return Task.FromResult(false);
}
return Navigation.PushModalAsync(page, animated);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment