예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here

            SetContentView(Resource.Layout.FinishQuizLayout);

            DBStore db = new DBStore();

            btnTryAgain      = FindViewById <Button>(Resource.Id.btnTryAgain);
            txtTotalQuestion = FindViewById <TextView>(Resource.Id.txtTotalQuestion);
            txtTotalScore    = FindViewById <TextView>(Resource.Id.txtTotalScore);

            btnTryAgain.Click += delegate
            {
                Intent intent = new Intent(this, typeof(MainActivity));
                StartActivity(intent);
                Finish();
            };

            Bundle bundle = Intent.Extras;

            if (bundle != null)
            {
                int score         = bundle.GetInt("Score");
                int totalQuestion = bundle.GetInt("Total");
                int correctAnswer = bundle.GetInt("Correct");

                txtTotalScore.Text    = $"Score: {score}";
                txtTotalQuestion.Text = $"You got {correctAnswer}/{totalQuestion}";

                db.InsertScore(score);
            }
        }