Merge pull request #2855 from andrechi1/develop

Implement MvxWindowsPage.ClearBackStack
This commit is contained in:
Martijn van Dijk 2018-05-07 14:11:47 +02:00 коммит произвёл GitHub
Родитель 7b817949e8 56919b2a01
Коммит 3d831466ff
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 20 добавлений и 11 удалений

Просмотреть файл

@ -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. // The .NET Foundation licenses this file to you under the MS-PL license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Windows.UI.Xaml; using System.Linq;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using MvvmCross.Platforms.Uap.Views.Suspension; using MvvmCross.Platforms.Uap.Views.Suspension;
using MvvmCross.ViewModels; using MvvmCross.ViewModels;
using MvvmCross.Views; 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 namespace MvvmCross.Platforms.Uap.Views
{ {
@ -66,14 +68,21 @@ namespace MvvmCross.Platforms.Uap.Views
} }
} }
public void ClearBackStack() public virtual void ClearBackStack()
{ {
throw new NotImplementedException(); var backStack = base.Frame?.BackStack;
/*
// note - we do *not* use CanGoBack here - as that seems to always returns true! while (backStack?.Any())
while (NavigationService.BackStack.Any()) {
NavigationService.RemoveBackEntry(); backStack.RemoveAt(0);
*/ }
UpdateBackButtonVisibility();
}
protected virtual void UpdateBackButtonVisibility()
{
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
} }
private string _reqData = string.Empty; private string _reqData = string.Empty;