Esempio n. 1
0
        //--------------------------EVENT METHODS----------------------------------//

        /// <summary>
        /// This Method: 1) Opens a local copy of the qaDictionary
        ///     1.  If it is called as a result of using the QA Tree form's Create/Edit button
        ///         then the qaFileNameString is the file name.
        ///         a.  If the retrieved qaFilePath is blank and new dictionary is called else
        ///         b.  The dictionary associated with an extant qaFile is loadee
        ///     2.  If it is called by Openeing the form from the dashboard then the qaFileNameString
        ///         is blank and the method is skipped
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void QuestionAndAnswerForm_Load(object sender, EventArgs e)
        {
            string qaFileNameString = AnswerQuestionsDataModel.getQAFileNameStr();

            if (qaFileNameString != "")
            {
                string qaFilePath = AnswerQuestionsDataModel.getQAFilePath();
                if (qaFilePath == "")
                {
                    // Get a blank dictionary
                    qaDictionary             = AnswerQuestionsDataModel.QandADictionary;
                    questionNumberValue.Text = qaDictionary.Count.ToString();
                    questionValue.Select();
                    return;
                }
                AnswerQuestionsDataModel.loadQAFileIntoDictionary(AnswerQuestionsDataModel.getQAFilePath());
                qaDictionary = AnswerQuestionsDataModel.QandADictionary;
                selectEditTypeLable.Visible = true;
            } //End if (qaFileNameString != "")
        }     // End QuestionAndAnswerForm_Load
Esempio n. 2
0
        /// <summary>
        /// This form can be called from the QATreeForm's
        /// takeQAFileTestButton_Click( method
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AnswerQuestionsForm_Load(object sender, EventArgs e)
        {
            string qaFilePath = AnswerQuestionsDataModel.getQAFilePath();
            // Get the int value at the end of the name
            string tempQAFilePathName = qaFilePath.Substring(0, qaFilePath.Length - 4);

            char[] tempQAFilePathNameArray = tempQAFilePathName.ToCharArray();
            keyIntStr = "";
            char lastChar = tempQAFilePathNameArray[tempQAFilePathNameArray.Length - 1];

            while (Char.IsDigit(lastChar))
            {
                keyIntStr = lastChar + keyIntStr;
                Array.Resize(ref tempQAFilePathNameArray, tempQAFilePathNameArray.Length - 1);
                lastChar = tempQAFilePathNameArray[tempQAFilePathNameArray.Length - 1];
            }
            // Convert this value to an integer
            keyToQAFileNameScoresDictionary = Int32.Parse(keyIntStr);

            AnswerQuestionsDataModel.loadQAFileIntoDictionary(qaFilePath);
            // Call initializeVariables() to initialize local variables
            initializeVariables();
        }// End void AnswerQuestionsForm_Load(