Class RegionNavigationContentLoader
Implementation of IRegionNavigationContentLoader that relies on a CommonServiceLocator.IServiceLocator to create new views when necessary.
Implements
Namespace: Sartorius.SAF.Presentation.Regions
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public class RegionNavigationContentLoader : IRegionNavigationContentLoader
Constructors
View SourceRegionNavigationContentLoader(IServiceLocator)
Initializes a new instance of the RegionNavigationContentLoader class with a service locator.
Declaration
public RegionNavigationContentLoader(IServiceLocator serviceLocator)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceLocator | serviceLocator | The service locator. |
Methods
View SourceCreateNewRegionItem(string)
Provides a new item for the region based on the supplied candidate target contract name.
Declaration
protected virtual object CreateNewRegionItem(string candidateTargetContract)
Parameters
| Type | Name | Description |
|---|---|---|
| string | candidateTargetContract | The target contract to build. |
Returns
| Type | Description |
|---|---|
| object | An instance of an item to put into the IRegion. |
GetCandidatesFromRegion(IRegion, string)
Returns the set of candidates that may satisfy this navigation request.
Declaration
protected virtual IEnumerable<object> GetCandidatesFromRegion(IRegion region, string candidateNavigationContract)
Parameters
| Type | Name | Description |
|---|---|---|
| IRegion | region | The region containing items that may satisfy the navigation request. |
| string | candidateNavigationContract | The candidate navigation target as determined by GetContractFromNavigationContext(NavigationContext) |
Returns
| Type | Description |
|---|---|
| IEnumerable<object> | An enumerable of candidate objects from the IRegion |
GetContractFromNavigationContext(NavigationContext)
Returns the candidate TargetContract based on the NavigationContext.
Declaration
protected virtual string GetContractFromNavigationContext(NavigationContext navigationContext)
Parameters
| Type | Name | Description |
|---|---|---|
| NavigationContext | navigationContext | The navigation contract. |
Returns
| Type | Description |
|---|---|
| string | The candidate contract to seek within the IRegion and to use, if not found, when resolving from the container. |
LoadContent(IRegion, NavigationContext)
Gets the view to which the navigation request represented by navigationContext applies.
Declaration
public object LoadContent(IRegion region, NavigationContext navigationContext)
Parameters
| Type | Name | Description |
|---|---|---|
| IRegion | region | The region. |
| NavigationContext | navigationContext | The context representing the navigation request. |
Returns
| Type | Description |
|---|---|
| object | The view to be the target of the navigation request. |
Remarks
If none of the views in the region can be the target of the navigation request, a new view is created and added to the region.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | when a new view cannot be created for the navigation request. |