private async Task <int> FindCountAsync() { var firstPage = PageCache.FirstOrDefault(p => p != null); var page = firstPage ?? await GetPageUncheckedAsync(0).ConfigureAwait(false); return(page.NumPages); }
/// <inheritdoc cref="CodeMonkeys.Navigation.INavigationService.Unregister{TViewModelInterface}" /> public void Unregister <TViewModel>() where TViewModel : class, IViewModel { if (!IsRegistered(typeof(TViewModel))) { return; } var registrationInfo = NavigationRegistrations .First(registration => registration.ViewModelType == typeof(TViewModel)); var cachedPage = PageCache.FirstOrDefault( cache => cache.Type == registrationInfo.ViewType); if (cachedPage != null) { PageCache.Remove(cachedPage); } NavigationRegistrations.Remove(registrationInfo); Log?.Info($"Unregistered views from ViewModel of type {typeof(TViewModel).Name}."); }