Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Shell] statically expose the current shell #4625

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

Comments

@StephaneDelcroix
Copy link
Member

commented Dec 4, 2018

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

This comment has been minimized.

Copy link
Member Author

commented Dec 4, 2018

of course, the proposed api is invalid

what about

Shell.CurrentShell.GoToAsync(...)

@StephaneDelcroix StephaneDelcroix added e/1 🕐 and removed e/2 🕑 labels Dec 4, 2018

StephaneDelcroix added a commit that referenced this issue Dec 4, 2018
@StephaneDelcroix StephaneDelcroix referenced this issue Dec 4, 2018
2 of 3 tasks complete

@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

@rmarinho rmarinho closed this in 133e627 Dec 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2 participants
You can’t perform that action at this time.