Skip to content

Commit

Permalink
Update JsonNavigationService.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed Dec 26, 2024
1 parent 43dc6ad commit 134c8b4
Showing 1 changed file with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ private void OnNavigated(object sender, NavigationEventArgs e)
}
else
{
var currentItem = (NavigationViewItem)_navigationView.SelectedItem;
var currentTag = currentItem?.Tag?.ToString();
if (string.IsNullOrEmpty(currentTag))
{
return;
}

if (e.Parameter is BaseDataInfo dataInfo && dataInfo != null)
if (_navigationView.SelectedItem is NavigationViewItem currentItem && currentItem.Tag is string currentTag && !string.IsNullOrEmpty(currentTag) && e.Parameter is BaseDataInfo dataInfo)
{
if (e.NavigationMode == NavigationMode.Back || !currentTag.Equals(dataInfo.UniqueId))
{
Expand Down Expand Up @@ -88,15 +81,13 @@ private void OnSelectionChanged(NavigationView sender, NavigationViewSelectionCh
}
else
{
var selectedItem = args.SelectedItemContainer as NavigationViewItem;
var dataInfo = selectedItem.DataContext as BaseDataInfo;
if (_sectionPage != null && !string.IsNullOrEmpty(dataInfo?.SectionId))
if (args.SelectedItemContainer is NavigationViewItem selectedItem && selectedItem.DataContext is BaseDataInfo dataInfo)
{
NavigateTo(SectionPageKey, dataInfo);
}
else
{
NavigateTo(dataInfo?.UniqueId, dataInfo);
var targetKey = !string.IsNullOrEmpty(dataInfo.SectionId) && _sectionPage != null
? SectionPageKey
: dataInfo.UniqueId;

NavigateTo(targetKey, dataInfo);
}
}
}
Expand Down

0 comments on commit 134c8b4

Please sign in to comment.