private void ShowQuestions(bool rightAnswer) { RandomQuestion newQuestion = new RandomQuestion(); questions_math.Text = newQuestion.FirstOperand.ToString() + " " + newQuestion.Operand + " " + newQuestion.SecondOperand.ToString(); submitAnswer.Click += (sender, e) => { totalQuestions++; readyText.Text = inkView.Recognize(false); rightAnswer = validateAnswer(newQuestion); if (rightAnswer) { newQuestion = createNewQuestion(); } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.MadMinute); //Get the username username = Intent.GetStringExtra("UserName"); WritePadAPI.recoInit(BaseContext); WritePadAPI.initializeFlags(BaseContext); button = FindViewById <Button> (Resource.Id.RecognizeButton); inkView = FindViewById <InkView> (Resource.Id.ink_view); readyText = FindViewById <TextView> (Resource.Id.ready_text); topLayerCount = FindViewById <LinearLayout> (Resource.Id.topLayerCount); containerLayer = FindViewById <FrameLayout> (Resource.Id.containerLayer); countdownView = FindViewById <TextView> (Resource.Id.countdownStart); ReadyGoStop = FindViewById <TextView> (Resource.Id.ReadyGoStop); questions_math = FindViewById <TextView> (Resource.Id.questions_math); submitAnswer = FindViewById <Button> (Resource.Id.submitAnswer); finalTotalScore = FindViewById <TextView> (Resource.Id.finalTotalScore); replayGame = FindViewById <Button> (Resource.Id.replayGame); countDownView = FindViewById <TextView> (Resource.Id.time_countdown); goBack = FindViewById <Button> (Resource.Id.goBack); countVariable = 3; //calculateTime (countVariable); topLayerCount.Visibility = Android.Views.ViewStates.Invisible; if (endTime) { return; } ReadyGoStop.Text = "GO!"; int minuteTime = 60; StartCountdownTimer(minuteTime); bool rightAnswer = false; ShowQuestions(rightAnswer); readyText.MovementMethod = new ScrollingMovementMethod(); //readyTextTitle.Text = Resources.GetString (Resource.String.Title) + " (" + WritePadAPI.getLanguageName () + ")"; button.Click += delegate { readyText.Text = inkView.Recognize(false); }; goBack.Click += delegate { var activity2 = new Intent(this, typeof(Activity2)); activity2.PutExtra("UserName", username); //activity2.PutExtra ("UserEmail", e.mProfile.Email); StartActivity(activity2); }; replayGame.Click += delegate { replayGame.Enabled = false; restartSettings(); }; /* WritePad SDK recognizing what the user wrote.*/ inkView.OnReturnGesture += () => readyText.Text = inkView.Recognize(true); inkView.OnReturnGesture += () => inkView.cleanView(true); inkView.OnCutGesture += () => inkView.cleanView(true); var clearbtn = FindViewById <Button> (Resource.Id.ClearButton); clearbtn.Click += delegate { readyText.Text = ""; inkView.cleanView(true); }; }