dansiegel / dansiegel/Prism-Shell-Stream
Validate single instance of the NavigationParameters are used
- Dominant language
- C#
- Stars
- 11
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
# Description
Each Navigation Segment can have its own Navigation Parameters via the Query String. This is then combined with shared NavigationParameters.
```cs
await _navigationService.NavigateAsync("ViewA?id=5&grapes=purple/ViewB?id=3", new NavigationParameters { { "message", "Hello World" } });
```
In the sample above we would expect that all Views navigated to would have NavigationParameters with the key `message` that has the value `Hello World`. We would then expect that both ViewA and ViewB would have a parameter with the key `id`, however ViewA would expect a value of `5` while ViewB would expect the value `3`. Lastly we would expect ViewA to additionally contain the key `grapes` with the value `purple`.
```cs
// ViewA
new NavigationParameters
{
{ "message", "Hello World" },
{ "id", 5 },
{ "grapes", "purple" }
};
// ViewB
new NavigationParameters
{
{ "message", "Hello World" },
{ "id", 3 }
};
```
What we need to confirm is that when a View is Initialized you could affect the state of the NavigationParameters and expect that state to carry over to OnNavigatedTo. For this scenario we would look at ViewB...
```cs
// ViewB IInitialize.Initialize
public void Initialize(INavigationParameters parameters)
{
parameters.Add("test", "foo");
}
```
We would then expect that:
```cs
// ViewA INavigationAware.OnNavigatedFrom
public void OnNavigatedFrom(INavigationParameters parameters)
{
// Should be True
var containsKey = parameters.ContainsKey("test");
// Should be foo
var test = parameters.GetValue("test");
parameters.Add("test", "bar");
}
// ViewB INavigationAware.OnNavigatedTo
public void OnNavigatedTo(INavigationParameters parameters)
{
// Should be True
var containsKey = parameters.ContainsKey("test");
// Should contain the strings `foo` and `bar`
var test = parameters.GetValues("test");
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing NavigationParameters through INavigationService.NavigateAsync and the IInitialize.Initialize, INavigationAware.OnNavigatedFrom, and OnNavigatedTo lifecycle methods. Reproduce the ViewA/ViewB example and verify whether the shared message, segment-specific values, and mutations to the test parameter persist as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100