Skip to content

Commit

Permalink
Fix NavigationCache
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed Jul 28, 2023
1 parent f9eb6f5 commit 480c39b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions TvTime/Views/Pages/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,29 @@ public MainPage()
if (page != null && e.SourcePageType != typeof(DetailPage))
{
page.NavigationCacheMode = NavigationCacheMode.Disabled;
if (MediaPage.Instance != null && CanDisableCache(e.Parameter, MediaPage.Instance.PageType.ToString()))
{
MediaPage.Instance.NavigationCacheMode = NavigationCacheMode.Disabled;
}
}
};
}

private bool CanDisableCache(object parameter, string pageType)
{
var parameterItem = parameter as DataItem;

if (parameterItem != null)
{
var item = parameterItem.Parameter?.ToString();
if (!string.IsNullOrEmpty(item) && item.Equals(pageType))
{
return false;
}
}
return true;
}

private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
var settings = (NavigationViewItem) NavView.SettingsItem;
Expand Down

0 comments on commit 480c39b

Please sign in to comment.