예제 #1
0
        private void initializeAndAddFactsDisplayControl()
        {
            m_factsDisplayControl = FactsDisplayControl.Instance;
            m_factsDisplayControl.Enabled = false;
            m_factsDisplayControl.Visible = false;
            m_factsDisplayControl.InputDetected += c_InputDetected;

            this.Controls.Add (m_factsDisplayControl);
        }
예제 #2
0
        /*
         * Handles starting the daily facts and speed test.
         */
        public void startProcessingFacts(bool speedTest, MathOperation operation, FactsDisplayControl displayControl, 
													 bool processingAllDailyFacts, UserProfile userProfile)
        {
            MathOperationTypeEnum opType = MathFactsForm.operationType.operationType;
            // Suppress messages if all daily facts are being processed.
            if (!MathFactsForm.speedTest && !getSavedResponseTime (opType, factResponseTime, ref maxResponseTime))
            {
                if (!processingAllDailyFacts)
                {
                    // No saved response data was found for this fact type.
                    MathFactsForm.toggleInputDisplay ();

                    String operatorName = MathFactsForm.operationType.ToString ();
                    MathFactsForm.m_factsDisplayControl.messageLabel.Text = "No data could be found for " + operatorName + " facts.\n"
                                + "Please take the " + operatorName + " speed test first.\n" + MathFactsForm.COMPLETION_CONTINUE_PROMPT;
                    return;
                }
            }

            correctResponseCount = 0;
            numberOfFactsProcessed = 0;

            if (!speedTest)
            {
                generateFactsList (ref queueOfFacts, operation, userProfile);
            }
            else
            {
                if (userProfile.hasCustomSpeedFacts)
                {
                    randomizeFacts (ref queueOfFacts, FactsFiles.loadCustomSpeedFacts (operation));
                }
                else
                {
                    randomizeFacts (ref queueOfFacts, FactsFiles.loadDefaultSpeedFacts (operation));
                }
            }

            if (queueOfFacts.Count () == 0)
            {
                if (!processingAllDailyFacts)
                {
                    MathFactsForm.toggleInputDisplay ();
                    displayControl.messageLabel.Text = "You have mastered all the facts, there are none to practice!\n"
                            + MathFactsForm.COMPLETION_CONTINUE_PROMPT;
                }
            }
            else
            {
                // Set up the progress bar.
                FactsDisplayControl reference = FactsDisplayControl.Instance;
                reference.factsProgressBar.Maximum = queueOfFacts.Count ();
                reference.factsProgressBar.Increment (1);

                // Display the first fact.
                displayControl.factSignLabel.Text = operation.getOperationSign ();
                displayControl.num1Label.Text = System.Convert.ToString (queueOfFacts.First ().leftNum);
                displayControl.num2Label.Text = System.Convert.ToString (queueOfFacts.First ().rightNum);

                displayControl.inputMaskedTextBox.Focus ();
                MathFactsForm.timer = System.Diagnostics.Stopwatch.StartNew ();
            }
        }