From 593194001ebfc3de5eca14fe8903d95e1683e26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Gimenez=20Mu=C3=B1oz?= Date: Sat, 5 May 2018 12:18:39 +0200 Subject: [PATCH 1/3] Implement MvxWindowsPage.ClearBackStack --- .../Platforms/Uap/Views/MvxWindowsPage.cs | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs b/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs index 24fc48358..f16d49b57 100644 --- a/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs +++ b/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs @@ -1,15 +1,17 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; +using System.Linq; using MvvmCross.Platforms.Uap.Views.Suspension; using MvvmCross.ViewModels; using MvvmCross.Views; +using Windows.UI.Core; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Navigation; namespace MvvmCross.Platforms.Uap.Views { @@ -68,12 +70,18 @@ namespace MvvmCross.Platforms.Uap.Views public void ClearBackStack() { - throw new NotImplementedException(); - /* - // note - we do *not* use CanGoBack here - as that seems to always returns true! - while (NavigationService.BackStack.Any()) - NavigationService.RemoveBackEntry(); - */ + var backStack = base.Frame?.BackStack; + + if (backStack != null) + { + while (backStack.Any()) + { + backStack.RemoveAt(0); + } + } + + SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; + } private string _reqData = string.Empty; From 8c3d003c3d9b11528d6158b3e353e733a0658c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Gimenez=20Mu=C3=B1oz?= Date: Sat, 5 May 2018 12:30:41 +0200 Subject: [PATCH 2/3] CodeFactor repair --- MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs b/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs index f16d49b57..d163f4c32 100644 --- a/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs +++ b/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs @@ -81,7 +81,6 @@ namespace MvvmCross.Platforms.Uap.Views } SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; - } private string _reqData = string.Empty; From 56919b2a01b660765ac7e49f3d3cfa3988145e9b Mon Sep 17 00:00:00 2001 From: Martijn van Dijk Date: Mon, 7 May 2018 14:10:53 +0200 Subject: [PATCH 3/3] Fix comments on PR --- MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs b/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs index d163f4c32..e00631efb 100644 --- a/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs +++ b/MvvmCross/Platforms/Uap/Views/MvxWindowsPage.cs @@ -68,18 +68,20 @@ namespace MvvmCross.Platforms.Uap.Views } } - public void ClearBackStack() + public virtual void ClearBackStack() { var backStack = base.Frame?.BackStack; - if (backStack != null) + while (backStack?.Any()) { - while (backStack.Any()) - { - backStack.RemoveAt(0); - } + backStack.RemoveAt(0); } + UpdateBackButtonVisibility(); + } + + protected virtual void UpdateBackButtonVisibility() + { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; }