protected override override void RenderContents(HtmlTextWriter writer)
    {
        IPage page = new PageWrapper(this.Page);

        this.MethodToTest(page);
        base.RenderContents(writer);
    }
Beispiel #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.DifficultySelect);

            // Since this page never changes during runtime, if the page is already setup, don't do it again.
            if (page != null)
            {
                return;
            }

            page = new PageWrapper();

            // Make new Intent to pass through to QuestionView
            Intent intent = new Intent(this, typeof(QuestionView));

            // For each button, add the intent key "Difficulty" and the respective DifficultyLevel seralized.
            new EasyView <Button>(page, FindViewById <Button>(Resource.Id.btnEasy), delegate
            {
                intent.PutExtra("Difficulty", DifficultyLevel.Easy.ToString());
                StartActivity(intent);
            });

            new EasyView <Button>(page, FindViewById <Button>(Resource.Id.btnMedium), delegate
            {
                intent.PutExtra("Difficulty", DifficultyLevel.Medium.ToString());
                StartActivity(intent);
            });

            new EasyView <Button>(page, FindViewById <Button>(Resource.Id.btnHard), delegate
            {
                intent.PutExtra("Difficulty", DifficultyLevel.Hard.ToString());
                StartActivity(intent);
            });
        }
Beispiel #3
0
 public PageViewModel(PageWrapper page)
 {
     Name = page.PageDisplayName;
     foreach (var sectionWrapper in page.Sections)
     {
         Sections.Add(new SectionViewModel(sectionWrapper));
     }
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            // If page exists, return.
            if (page != null)
            {
                return;
            }

            // Make new page.
            page = new PageWrapper();

            // Button to begin.
            new EasyView <Button>(page, FindViewById <Button>(Resource.Id.btnStart), delegate
            {
                StartActivity(typeof(DifficultySelect));
            });
        }
Beispiel #5
0
 public PDFPageWrapper(PageWrapper parent) : base(parent)
 {
 }
Beispiel #6
0
 public ImagePage(string path, PageWrapper parent)
 {
     this.path   = path;
     this.parent = parent;
     name        = path.Substring(path.LastIndexOf("\\") + 1, path.LastIndexOf(".") - path.LastIndexOf("\\") - 1);
 }
        // <summary>Loads the page display elements</summary>
        private void LoadPage()
        {
            this.page           = new PageWrapper();
            this.wrongQuestions = new List <RandomQuestion>();

            this.txtQuestionCounter = new EasyView <TextView>(page, FindViewById <TextView>(Resource.Id.txtQuestionCounter));
            this.txtScore           = new EasyView <TextView>(page, FindViewById <TextView>(Resource.Id.txtScore));
            this.txtTimeRemaining   = new EasyView <TextView>(page, FindViewById <TextView>(Resource.Id.txtTimeRemaining));
            this.txtQuestionBig     = new EasyView <TextView>(page, FindViewById <TextView>(Resource.Id.txtQuestionBig));
            this.inAnswer           = new EasyView <EditText>(page, FindViewById <EditText>(Resource.Id.inputAnswer));

            this.imgRightWrong = new EasyView <ImageView>(page, FindViewById <ImageView>(Resource.Id.imgRightWrong));

            this.soundRight = page.AddSound(Resource.Raw.sound_right, this);
            this.soundWrong = page.AddSound(Resource.Raw.sound_wrong, this);

            // Variable name submit does not always reflect the text.
            this.btnSubmit = new EasyView <Button>(page, FindViewById <Button>(Resource.Id.btnSubmit), delegate
            {
                // If their time is up, or they have answered, get the next question
                if (this.currentQuestion.TimeUp || this.currentQuestion.Answered)
                {
                    this.NextQuestion();
                    return;
                }

                // Ignore if input is empty.
                if (this.inAnswer.IsEmpty())
                {
                    return;
                }

                // Get the numerical answer.
                int answer = Parse(this.inAnswer.Text());
                // Stop interaction so they can't change their answer after submitting.
                this.inAnswer.AllowInteraction(false);

                // Register it is answered and update the "submit" button respectively.
                this.currentQuestion.Answered = true;
                this.btnSubmit.Text(this.currentQuestionNumber == MAX_QUESTIONS ? "See how you did!" : "Next Question");

                // If they got it right.
                if (this.currentQuestion.GetAnswer() == answer)
                {
                    // Increment and update score.
                    this.score++;
                    this.txtScore.Text($"Score: {this.score}");
                    // Display image for when they get it right.
                    this.imgRightWrong.ImageSource(Resource.Drawable.RIGHT);
                    this.soundRight.Start();
                }
                else
                {
                    // They got it wrong, so register as wrong question.
                    this.wrongQuestions.Add(this.currentQuestion);
                    // Display image for when they get it wrong.
                    this.imgRightWrong.ImageSource(Resource.Drawable.WRONG);
                    this.soundWrong.Start();
                }

                // Show if they got right or wrong.
                this.imgRightWrong.Show();
            });
        }