// *** Protected Methods *** protected void OnFlyoutClosed(object sender, object e) { // Remove all navigation entries from the stack // TODO : Add some way to indicate to VMs that they are closing - IClosingAware? NavigationStack.Clear(); }
public void Clear_TwoPagesNavigatedThenClear_CurrentPageIsNull() { NavigationStack navigationStack = new NavigationStack(); navigationStack.NavigateTo(new PageInfo("Page 1", null)); navigationStack.NavigateTo(new PageInfo("Page 2", null)); navigationStack.Clear(); Assert.Equal(null, navigationStack.CurrentPage); }
public void Clear_TwoPagesNavigatedThenClear_CountIsZero() { NavigationStack navigationStack = new NavigationStack(); navigationStack.NavigateTo(new PageInfo("Page 1", null)); navigationStack.NavigateTo(new PageInfo("Page 2", null)); navigationStack.Clear(); Assert.Equal(0, navigationStack.Count); }
protected void OnSettingsFlyoutUnloaded(object sender, object e) { // Raise the FlyoutClosed event OnFlyoutClosed(); // Remove all navigation entries from the stack // NB: Set the 'isUnloading' flag to stop reopening the system settings pane // TODO : Add some way to indicate to VMs that they are closing - IClosingAware? _isUnloading = true; NavigationStack.Clear(); _isUnloading = false; }
// *** Methods *** public void Clear() { _navigationStack.Clear(); }
public void PropertyChanged_CanGoBack_IsNotCalledWhenEmptyNavigationStackIsCleared() { NavigationStack navigationStack = new NavigationStack(); int changedCount = 0; navigationStack.PropertyChanged += delegate (object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "CanGoBack") changedCount++; }; navigationStack.Clear(); Assert.Equal(0, changedCount); }
public void PropertyChanged_CanGoBack_IsCalledWhenNavigationStackIsCleared() { NavigationStack navigationStack = new NavigationStack(); navigationStack.NavigateTo(new PageInfo("Page 1", null)); int changedCount = 0; navigationStack.PropertyChanged += delegate (object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "CanGoBack") changedCount++; }; navigationStack.Clear(); Assert.Equal(1, changedCount); }
public void NavigatingFrom_IsCalledWhenNavigationStackIsCleared() { NavigationStack navigationStack = new NavigationStack(); navigationStack.NavigateTo(new PageInfo("Page 1", null)); navigationStack.NavigateTo(new PageInfo("Page 2", null)); List<PageNavigationEventArgs> navigationEvents = new List<PageNavigationEventArgs>(); navigationStack.NavigatingFrom += delegate (object sender, PageNavigationEventArgs e) { navigationEvents.Add(e); }; navigationStack.Clear(); Assert.Equal(1, navigationEvents.Count); PageNavigationEventArgs navigationEvent = navigationEvents[0]; Assert.Equal(PageNavigationMode.Back, navigationEvent.NavigationMode); Assert.Equal("Page 2", navigationEvent.Page.PageName); }
public void CollectionChanged_IsCalledWhenNavigationStackIsCleared() { NavigationStack navigationStack = new NavigationStack(); navigationStack.NavigateTo(new PageInfo("Page 1", null)); navigationStack.NavigateTo(new PageInfo("Page 2", null)); List<NotifyCollectionChangedEventArgs> changeEvents = new List<NotifyCollectionChangedEventArgs>(); navigationStack.CollectionChanged += delegate (object sender, NotifyCollectionChangedEventArgs e) { changeEvents.Add(e); }; navigationStack.Clear(); Assert.Equal(1, changeEvents.Count); NotifyCollectionChangedEventArgs changeEvent = changeEvents[0]; Assert.Equal(NotifyCollectionChangedAction.Reset, changeEvent.Action); }