Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
kkolodziejczak committed Feb 10, 2020
2 parents 358a846 + d5eb392 commit 1637788
Show file tree
Hide file tree
Showing 21 changed files with 5,060 additions and 4,306 deletions.
36 changes: 36 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": 1,
"isRoot": true,
"tools": {
"coverlet.console": {
"version": "1.7.0",
"commands": [
"coverlet"
]
},
"dotnet-stryker": {
"version": "0.16.0",
"commands": [
"dotnet-stryker"
]
},
"gitversion.tool": {
"version": "5.1.3",
"commands": [
"dotnet-gitversion"
]
},
"dotnet-cleanup": {
"version": "0.6.0",
"commands": [
"cleanup"
]
},
"dotnet-reportgenerator-globaltool": {
"version": "4.4.7",
"commands": [
"reportgenerator"
]
}
}
}
41 changes: 36 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# XamarinIoCNavigation
Concept on how to create your own navigation using IoC container in Xamarin.
Concept on how to create your own navigation using IoC container in Xamarin. Based on that concept NuGet Package was created, and can be used in any Xamarin Forms application.

## Shortcuts
- [Basic usage](#Basic-usage)
- [All possibilities](#all-possibilities-of-xamarinbetternavigation)

[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/kkolodziejczak/XamarinIoCNavigation/blob/master/LICENSE)
[![Downloads](https://img.shields.io/nuget/dt/Xamarin.BetterNavigation.Forms)](https://www.nuget.org/packages/Xamarin.BetterNavigation.Forms/)


## Build Status ##
Expand All @@ -27,10 +28,10 @@ Concept on how to create your own navigation using IoC container in Xamarin.

`Xamarin.BetterNavigation.Core` have `INavigationService` interface to use inside your library that doesn't have reference to Xamarin. This helps to keep all references to minimum and invert dependencies of navigation in code.

### Basic usage ###
## Basic usage ##
To use `NavigationService` you need to have Xamarin `NavigationPage` from it you can get `INavigation` property that is used to navigate through application. After that you need to create class that implements `Xamarin.BetterNavigation.Forms.IPageLocator` interface. This class converts strings to Xamarin `Page`'s.
### Page Locator ###
##### TestDI.Common.PageLocator.cs #####
#### TestDI.Common.PageLocator.cs ####
```C#
public class PageLocator : IPageLocator
{
Expand Down Expand Up @@ -130,7 +131,7 @@ public App()
```
### Some Improvements ###
To keep this package universal as possible. We use strings to navigate but they are not as easy to use as enums. There is easy fix for that. You can create _extension methods_ for all methods of `INavigationService` and use enum instead of string for all pages that You want to use. All extension methods are created and ready to being copied in [this file](TestDI/TestDI/Common/NavigationServiceExtensions.cs).
##### TestDI.Common.NavigationServiceExtensions.cs #####
#### TestDI.Common.NavigationServiceExtensions.cs ####
```C#
public enum ApplicationPage
{
Expand Down Expand Up @@ -158,7 +159,7 @@ To keep this package universal as possible. We use strings to navigate but they
```


## All possibilities of Xamarin.BetterNavigation ###
## All possibilities of Xamarin.BetterNavigation ##
```C#
namespace Xamarin.BetterNavigation.Core
{
Expand Down Expand Up @@ -193,20 +194,41 @@ namespace Xamarin.BetterNavigation.Core
bool animated,
params (string key, object value)[] navigationParameters);

Task PopAllPagesAndGoToAsync(IEnumerable<string> pageNames,
params (string key, object value)[] navigationParameters);

Task PopAllPagesAndGoToAsync(IEnumerable<string> pageNames,
bool animated,
params (string key, object value)[] navigationParameters);

Task GoToAsync(string pageName,
params (string key, object value)[] navigationParameters);

Task GoToAsync(string pageName,
bool animated,
params (string key, object value)[] navigationParameters);

Task GoToAsync(IEnumerable<string> pageNames,
params (string key, object value)[] navigationParameters);

Task GoToAsync(IEnumerable<string> pageNames,
bool animated,
params (string key, object value)[] navigationParameters);

Task PopPageAndGoToAsync(string pageName,
params (string key, object value)[] navigationParameters);

Task PopPageAndGoToAsync(string pageName,
bool animated,
params (string key, object value)[] navigationParameters);

Task PopPageAndGoToAsync(IEnumerable<string> pageNames,
params (string key, object value)[] navigationParameters);

Task PopPageAndGoToAsync(IEnumerable<string> pageNames,
bool animated,
params (string key, object value)[] navigationParameters);

Task PopPageAndGoToAsync(byte amount,
string pageName,
params (string key, object value)[] navigationParameters);
Expand All @@ -215,6 +237,15 @@ namespace Xamarin.BetterNavigation.Core
string pageName,
bool animated,
params (string key, object value)[] navigationParameters);

Task PopPageAndGoToAsync(byte amount,
IEnumerable<string> pageNames,
params (string key, object value)[] navigationParameters);

Task PopPageAndGoToAsync(byte amount,
IEnumerable<string> pageNames,
bool animated,
params (string key, object value)[] navigationParameters);
}
}
```
Loading

0 comments on commit 1637788

Please sign in to comment.