Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10 from vniehues/develop
Browse files Browse the repository at this point in the history
Added GoToSection to BaseMethods
  • Loading branch information
vniehues authored May 11, 2022
2 parents c7b910f + ec94cea commit 52c7fda
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/mavvm/Navigation/BaseMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@ public static async Task GoBack(bool replaceStack = false, NavigationParameters
}
}

public static async Task GoToSection(string sectionRoute, NavigationParameters parameters = null, bool animate = true)
{
var path = $"//{sectionRoute}";

if (parameters is null)
{
await Shell.Current.GoToAsync(path, animate);
}
else
{
await Shell.Current.GoToAsync(path, animate, parameters);

if ((Shell.Current?.CurrentItem?.CurrentItem as IShellSectionController)?.PresentedPage.BindingContext is INavigateBackToAware vm)
{
vm.NavigatedBackTo(parameters);
}

}
}

public static async Task GoToViewModel<TViewModel>(bool replaceStack = false, NavigationParameters parameters = null)
{
var vmType = typeof(TViewModel);
Expand Down
2 changes: 1 addition & 1 deletion src/mavvm/mavvm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.18362.0</SupportedOSPlatformVersion>
<PackageId>mavvm</PackageId>
<PackageVersion>1.0.0</PackageVersion>
<PackageVersion>1.0.1</PackageVersion>
<Authors>Vincent Niehues</Authors>
<Copyright>Vincent Niehues 2021</Copyright>
<Owners>Vincent Niehues</Owners>
Expand Down

0 comments on commit 52c7fda

Please sign in to comment.