diff --git a/Breadcrumb/Breadcrumb.csproj b/Breadcrumb/Breadcrumb.csproj
index 5da9b23..8b7bfab 100644
--- a/Breadcrumb/Breadcrumb.csproj
+++ b/Breadcrumb/Breadcrumb.csproj
@@ -33,7 +33,7 @@
true
MIT
Xamarin.Forms.Breadcrumb
- 1.0.8
+ 2.0.0
diff --git a/Breadcrumb/Breadcrumb.xaml.cs b/Breadcrumb/Breadcrumb.xaml.cs
index 0c4bb3f..e92660e 100644
--- a/Breadcrumb/Breadcrumb.xaml.cs
+++ b/Breadcrumb/Breadcrumb.xaml.cs
@@ -127,15 +127,10 @@ public bool IsNavigationEnabled
// TODO: Separator Icon, Image, Text
#endregion Control properties
-
- private readonly INavigation _nav;
-
public Breadcrumb()
{
InitializeComponent();
- _nav = Navigation;
-
// Event fired the moment ContentView is displayed
Device.BeginInvokeOnMainThread(() =>
{
@@ -267,45 +262,31 @@ private void AnimatedStack_ChildAdded(object sender, ElementEventArgs e)
///
private async Task GoBack(Page selectedPage)
{
- System.Console.WriteLine($"{nameof(GoBack)} Clicked");
// Check if selectedPage is still in Navigation Stack
- if (!_nav.NavigationStack.Any(x => x.Equals(selectedPage)))
+ if (!Navigation.NavigationStack.Any(x => x == selectedPage))
{
- System.Console.WriteLine("Page not in stack");
// PopToRoot triggered if selectedPage is missing from navigation stack
- await _nav.PopToRootAsync();
- System.Console.WriteLine("Pop to root");
+ await Navigation.PopToRootAsync();
return;
}
- System.Console.WriteLine("Page in stack");
// Get all pages after and including selectedPage
- List pages = _nav.NavigationStack.SkipWhile(x => x != selectedPage).ToList();
+ List pages = Navigation.NavigationStack.SkipWhile(x => x != selectedPage).ToList();
- System.Console.WriteLine("List of pages after selected page -");
- pages.ForEach(x => System.Console.WriteLine(x.Title));
// Remove selectedPage
pages.Remove(selectedPage);
- System.Console.WriteLine("Selected page removed");
-
// Remove current page (this will be removed with a PopAsync after all other relevant pages are removed)
pages = pages.Take(pages.Count - 1).ToList();
- System.Console.WriteLine("Current page removed");
-
// Remove all pages left in list (i.e. all pages after selectedPage, minus the current page)
foreach (Page page in pages)
{
- _nav.RemovePage(page);
+ Navigation.RemovePage(page);
}
- System.Console.WriteLine("Pages inbetween selectedPage and CurrentPage removed");
-
// Remove current page
- await _nav.PopAsync();
-
- System.Console.WriteLine("Popasync");
+ await Navigation.PopAsync();
}
}
}
\ No newline at end of file