main pages are accessed via static fields

This commit is contained in:
2017-03-09 22:21:01 +01:00
parent e05716344b
commit 04f7229fe3

View File

@ -195,27 +195,32 @@ namespace ZicMoove
} }
BookQueriesPage bQueriesPage; static BookQueriesPage bQueriesPage;
AccountChooserPage accChooserPage; static AccountChooserPage accChooserPage;
ActivityPage homePage; static ActivityPage homePage;
private static UserProfilePage userProfilePage; private static UserProfilePage userProfilePage;
public static UserProfilePage UserProfilePage public static UserProfilePage UserProfilePage
{ get { return userProfilePage; } } { get { return userProfilePage; } }
ChatPage chatPage; static ChatPage chatPage;
PinPage pinPage; static PinPage pinPage;
public static void ShowPage(Page page) public static async void ShowPage(Page page)
{ {
if (page == homePage)
{
await Navigation.PopToRootAsync();
return;
}
if (Navigation.NavigationStack.Contains(page)) if (Navigation.NavigationStack.Contains(page))
{ {
if (Navigation.NavigationStack.Last() == page) return; if (Navigation.NavigationStack.Last() == page) return;
Navigation.RemovePage(page); Navigation.RemovePage(page);
page.Parent = null; page.Parent = null;
} }
Navigation.PushAsync(page); await Navigation.PushAsync(page);
} }
private void BuildMainPage() private void BuildMainPage()
@ -263,7 +268,7 @@ namespace ZicMoove
BindingContext = new ChatViewModel() BindingContext = new ChatViewModel()
}; };
pinPage = new PinPage(); pinPage = new PinPage { Title = Strings.Carte };
// var mainPage = new NavigationPage(bQueriesPage); // var mainPage = new NavigationPage(bQueriesPage);
@ -322,6 +327,7 @@ namespace ZicMoove
masterDetail.ToolbarItems.Add(tiHome); masterDetail.ToolbarItems.Add(tiHome);
masterDetail.ToolbarItems.Add(tiSetts); masterDetail.ToolbarItems.Add(tiSetts);
masterDetail.ToolbarItems.Add(tiPubChat); masterDetail.ToolbarItems.Add(tiPubChat);
masterDetail.ToolbarItems.Add(tiPinPage);
this.MainPage = masterDetail; this.MainPage = masterDetail;
NavigationService = new NavigationService(Navigation); NavigationService = new NavigationService(Navigation);