Пример #1
0
        private void PreviousPageHandler(object sender, MouseButtonEventArgs e)
        {
            CurrentPageModel currentClass = CurrentPageModel.getcurrentclass();

            currentClass._currentPage = "1";
            //Gets the Saved Instance of the first page and load it//
            Page page2 = CurrentPageModel.secondPage;

            if (page2 == null)
            {
                Page currentPage = new Page2();
                this.NavigationService.Navigate(currentPage);
                //this.NavigationService.Navigate(new Uri(@"\ProfilePages\ProfileCreationPage2.xaml", UriKind.RelativeOrAbsolute));
            }
            else
            {
                this.NavigationService.Navigate(page2);
                WpfApp1.NavigationControls.NavigationControls secondControl = (WpfApp1.NavigationControls.NavigationControls)CurrentPageModel.secondControl;
                secondControl.buttonManipulation(currentClass.currentpage);
                secondControl.PageNumber.Text = secondControl.currentPageNumber(currentClass.currentpage);
            }
            //Save the Instance of the thirdPage page//
            CurrentPageModel.thirdPage = this;
            //Save the Instance of the second page controls//
            CurrentPageModel.thirdControl = page3Controls;
        }
        private void NextPageHandler(object sender, MouseButtonEventArgs e)
        {
            Boolean isValidated = checkValidation();
            string  data        = null;

            if (option1.IsChecked == true)
            {
                data = "a";
            }
            if (option2.IsChecked == true)
            {
                data = "b";
            }
            if (option3.IsChecked == true)
            {
                data = "c";
            }
            if (option4.IsChecked == true)
            {
                data = "d";
            }

            UserModel.UserModel currentUserModel = UserModel.UserModel.currentUserModel;
            currentUserModel.profile1            = data;
            UserModel.UserModel.currentUserModel = currentUserModel;

            if (isValidated == true)
            {
                CurrentPageModel currentClass = CurrentPageModel.getcurrentclass();
                currentClass._currentPage = "1";
                //Load the Saved Instance of the second page//
                Page page2 = CurrentPageModel.secondPage;
                if (page2 == null)
                {
                    Page newPage = new Page2();
                    //this.NavigationService.Navigate(new Uri(@"\ProfilePages\ProfileCreationPage2.xaml", UriKind.RelativeOrAbsolute));
                    this.NavigationService.Navigate(newPage);
                }
                else
                {
                    this.NavigationService.Navigate(page2);
                    WpfApp1.NavigationControls.NavigationControls secondControl = (WpfApp1.NavigationControls.NavigationControls)CurrentPageModel.secondControl;
                    secondControl.buttonManipulation(currentClass.currentpage);
                    secondControl.PageNumber.Text = secondControl.currentPageNumber(currentClass.currentpage);
                }
            }
            else
            {
                MessageBox.Show("No option have been chosen. Please choose your option");
            }

            //Save the Instance of the first page
            CurrentPageModel.firstPage = this;
            //Save the Instance of the first page controls
            CurrentPageModel.firstControl = page1Controls;
        }