public async Task Remove(CancellationToken ct, INavigationHistoryEntry entry) { await _remove(ct, entry); _entries.Remove(entry); _viewModels.Remove(entry.Request); }
private async Task RemoveHistoryEntry(CancellationToken ct, INavigationHistoryEntry arg) { if (arg.IsAlive) { var aliveEntry = (AliveNavigationHistoryEntry)arg; await ThreadPool.RunAsync(operation => _viewModelFactory.ReleaseViewModel(aliveEntry.ViewModel), WorkItemPriority.Low); } }
private async Task NavigateBackWithNotAliveRequest(CancellationToken ct, INavigationHistoryEntry previousEntry) { //entries has no navigation page created so we navigate to the page and remove var last = _history.Entries.Last(); await Navigate(ct, previousEntry.Request); await _dispatcherScheduler.Run(() => _frame.RemoveBackEntry()); //removes the previous entry which was not alive await _history.Remove(ct, previousEntry); //removes the last entry which was the page where the back navigation was made await _history.Remove(ct, last); }