コード例 #1
0
        //The function mapped to the next button in the .xaml page.
        async void OnNextButtonClicked(object sender, EventArgs e)
        {
            //Since Xamarin decided that double tapping a tab pops back to the root
            //of that tab's navigation page WITHOUT any kind of event, this code makes sure
            //the matchIndex doesn't get screwed up.
            if (matchName.Text != allUsers[matchIndex].FullName && !justRemovedMatch)
            {
                matchIndex = 0;
            }

            //Switches the page to the next generated match, setting the proper match index.
            if (matchIndex < allUsers.Count - 1 || justRemovedMatch)
            {
                if (!justRemovedMatch)
                {
                    matchIndex += 1;
                }

                MatchesPage nextPage = new MatchesPage();

                await Navigation.PushAsync(nextPage);

                if (justRemovedMatch)
                {
                    App.tabbedPage.currentMatchesPage = nextPage;
                    Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count() - 2]);
                }
            }
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: brahndun/4330Project
        //Constructor which sets the current view to be a MatchesPage, but leaves the navigation bar at the bottom of the app.
        public MainPage()
        {
            InitializeComponent();

            App.tabbedPage     = this;
            currentMatchesPage = curMatchPage;

            this.BarBackgroundColor = Color.FromRgb(60, 133, 186);
            this.UnselectedTabColor = Color.FromRgb(40, 40, 40);
            this.SelectedTabColor   = Color.FromRgb(240, 240, 240);
        }
コード例 #3
0
        //Go to the match page of the specified user
        public async void GoToUser(User u)
        {
            //Index of the user within the allUsers list
            int index;

            index = allUsers.FindIndex(x => x.ID == u.ID);

            //Navigates to the user's match page while popping and pushing any
            //inbetween pages to and from the navigation stack
            if (index - matchIndex > 0)
            {
                while (matchIndex < index)
                {
                    if (!justRemovedMatch)
                    {
                        matchIndex += 1;
                    }

                    MatchesPage nextPage = new MatchesPage();

                    Navigation.PushAsync(nextPage);

                    if (justRemovedMatch)
                    {
                        App.tabbedPage.currentMatchesPage = nextPage;
                        Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count() - 2]);
                    }
                }
            }
            if (index - matchIndex < 0)
            {
                while (matchIndex > index)
                {
                    matchIndex--;
                    await Navigation.PopAsync();
                }
            }
        }