コード例 #1
0
ファイル: MainActivity.cs プロジェクト: brunnurs/HarmNumb
        void DisplayButtonLabels(NoteDegreeCorrelation nextExercise)
        {
            List<NoteDegreeCorrelation> allCorrelationsForKey = NoteDegreeCorrelationFactory.GetCorrelationsForKey(nextExercise.Key);

            //Randomize, because otherwise it's too easy, as the degree is ordered.
            allCorrelationsForKey = allCorrelationsForKey.RandomizeOrder();

            for (int i = 0; i < 7; i++)
            {
                if (displayNoteButtons)
                {
                    allButtons[i].Text = allCorrelationsForKey[i].Note;
                }
                else
                {
                    allButtons[i].Text = (i + 1).ToString();
                }
            }
        }
コード例 #2
0
ファイル: QuizController.cs プロジェクト: brunnurs/HarmNumb
        public NoteDegreeCorrelation GetNextExercise()
        {
            //            Log.Debug("harm-numb", "Currently in queue:");
            //            foreach (var kv in unsuccessfullOrSlowAttempts)
            //            {
            //                Log.Debug("harm-numb",kv.Key + "  " + kv.Value.Key+":"+kv.Value.Note);
            //            }

            if (counter % RepeatAfterXExercise == 0 && unsuccessfullOrSlowAttempts.Count > 0)
            {
                //Repeat wrong answers
                int mostUrgentToRepeat = unsuccessfullOrSlowAttempts.Keys.Max();
                currentExercise = unsuccessfullOrSlowAttempts[mostUrgentToRepeat];

                unsuccessfullOrSlowAttempts.Remove(mostUrgentToRepeat);
            }
            else
            {
                //Random exercise
                currentExercise = allCorrelations[rnd.Next(0, allCorrelations.Count)];
            }

            counter++;
            currentExerciseStartedAt = DateTime.Now;

            return currentExercise;
        }
コード例 #3
0
ファイル: MainActivity.cs プロジェクト: brunnurs/HarmNumb
        private void DisplayExercise(NoteDegreeCorrelation nextExercise)
        {
            DisplayButtonLabels(nextExercise);

            imgKey.SetImageDrawable(Resources.GetDrawable(keyImagePathResolver.GetKeyDrawableByKey(nextExercise.Key)));
            txtKey.Text = String.Format("{0}",nextExercise.Key);

            if (displayNoteButtons)
            {
                txtHarmNumber.Text = nextExercise.Degree.ToString();
            }
            else
            {
                txtHarmNumber.Text = nextExercise.Note;
            }

            exerciseTimer.Start();
        }