Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Shell] statically expose the current shell #4625

Closed
StephaneDelcroix opened this issue Dec 4, 2018 · 1 comment
Closed

[Shell] statically expose the current shell #4625

StephaneDelcroix opened this issue Dec 4, 2018 · 1 comment
Assignees
Projects
Milestone

Comments

@StephaneDelcroix
Copy link
Member

Summary

Getting a reference to the current shell is tedious and repetitive. As the shell has to be the App.MainPage, we could expose a static version of GoToAsync() that tries to get the shell from there. If the shell is not found, an exception will be thrown.

If the user want to navigate on a shell that's not currently App.MainPage (multiple shell app, anyone ?) he can still keep a reference to that shell and use the non-static GoToAsync

this is required for #4594

API Changes

public Task static Shell.GoToAsync(ShellNavigationState state, bool animate = true);

Intended Use Case

replace this usage

var shell = Application.Current.MainPage as Shell;
await shell.GoToAsync("app:///s/about?welcome=you");

by

await Shell.GoToAsync("app:///s/about?welcome=you");
@StephaneDelcroix
Copy link
Member Author

StephaneDelcroix commented Dec 4, 2018

of course, the proposed api is invalid

what about

Shell.CurrentShell.GoToAsync(...)

StephaneDelcroix added a commit that referenced this issue Dec 4, 2018
@samhouts samhouts added this to the 3.5.0 milestone Dec 4, 2018
@samhouts samhouts added this to In Progress in v3.5.0 Dec 4, 2018
@samhouts samhouts removed this from New in Triage Dec 4, 2018
@samhouts samhouts moved this from In Progress to Done in v3.5.0 Dec 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
v3.5.0
  
Done
Development

No branches or pull requests

2 participants