コード例 #1
0
        public SinglePageNavigationPage()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            InitializeComponent();

            Resources["ButtonStyle"] = Resources["answerStyle"];

            Resources["FlagButtonStyle"] = Resources["flagDefaultStyle"];

            // Set Title to zero-based instance of this class.
            int questionNumber = (count++) + 1;


            if ((bool)Application.Current.Properties["IsNewQuiz"])
            {
                var subject = Application.Current.Properties["subject"] + ".json";
                QuestionData.InitialiseQuestions(subject);
                Application.Current.Properties["IsNewQuiz"] = false;
            }


            IDictionary <string, object> properties = Application.Current.Properties;

            if (properties.ContainsKey("TimerStatus") && (string)properties["TimerStatus"] == "Started")
            {
                //timer has started
            }
            else
            {
                //reset
                QuestionData.GetQuestions.Reset();
                _timerViewModel = new TimerViewModel();
                _timerViewModel.IsVisiblePrevNavButton = true;
                //_timerViewModel.IsVisibleFinishButton = false;
                Application.Current.Properties["TimerStatus"] = "Started";
            }
            var numberOfQuestions = QuestionData.GetQuestions.questions.Count;

            Title          = "Q" + questionNumber + " of " + numberOfQuestions;
            BindingContext = _timerViewModel;
        }