Example #1
0
        public void AddItem(AdditionQuestion question)
        {
            var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            var path        = Path.Combine(appDataPath, FILES_SUBFOLDER);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            var pathHistory = Path.Combine(path, FILE_HISTORY_NAME);
            var pathResult  = Path.Combine(path, FILE_RESULT_NAME);

            File.AppendAllText(pathResult, question.ToBeautifulString());
            File.AppendAllText(pathHistory, question.ToString());
        }
Example #2
0
        public void VerifyResult()
        {
            // Verify if value was entered correctly
            if (UserResult == 0)
            {
                VerificationCode = VerificationCodeList.RESULT_ERROR_INVALID_ENTRY;
            }
            else
            {
                AdditionQuestion addQuestion = new AdditionQuestion(FirstNumber, SecondNumber, UserResult);

                if (addQuestion.Result)
                {
                    VerificationCode = VerificationCodeList.RESULT_OK;
                }
                else
                {
                    VerificationCode = VerificationCodeList.RESULT_WRONG;
                }

                HistoryFile histfile = new HistoryFile();
                histfile.AddItem(addQuestion);
            }
        }