예제 #1
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            Loaded += (s, e) =>
            {
                _flipTemplate = new FlipTileTemplate();
                IOHelper io      = new IOHelper();
                string   profile = io.Read("profile.json");
                if (profile.Equals(""))
                {
                    io.Write("profile.json", JsonConvert.SerializeObject(new Profile()
                    {
                        QuizContent  = new QuizContent(),
                        SolvedCount  = 0,
                        SolvedQuizes = new List <string>()
                    }));
                    profile = io.Read("profile.json");
                }
                QuizHelper qh = new QuizHelper();
                System.Diagnostics.Debug.WriteLine(qh.getProfileString());
                _flipTemplate.SFlipTileTemplate();
            };


            //Shows the rate reminder message, according to the settings of the RateReminder.
            (App.Current as App).rateReminder.Notify();
        }
예제 #2
0
        private void openExamBtn_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog opendialog = new OpenFileDialog();
                opendialog.Filter       = "FCT Exam File (*.FCTEX)|*.FCTEX";
                opendialog.DefaultExt   = "FCTEX";
                opendialog.AddExtension = true;

                if (opendialog.ShowDialog() == DialogResult.OK)
                {
                    examStringEncrypted = ExamHelper.GetExamFileAsBytes(opendialog.FileName);

                    anExam = ExamHelper.GetExamFromFile(opendialog.FileName, studentPassTxtBox.Text, "", FilterationSecurityLevel.Moderate);
                    foreach (var q in anExam.QuestionsList)
                    {
                        QuizHelper.AddQuestionTortb(ref rtb, q.QuestionNumber, q, true, true);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #3
0
        private void listQuestionsBtn_Click(object sender, EventArgs e)
        {
            Label stat = new Label {
                Text = "----------- S T A T I C - Q U E S T I O N S -------------", AutoSize = true
            };

            flowLayout.Controls.Add(stat);
            flowLayout.SetFlowBreak(stat, true);

            FATFileSystemExamTemplate aFatTemplate = new FATFileSystemExamTemplate(aLogger, ref anMbr);

            QuizHelper.AddQuestionsToFlowLayout(aFatTemplate.GetStaticFATQuestions, ref flowLayout, ref richTextBox1, ref aLogger, ref FinalQuestions);

            Label dyn = new Label {
                Text = "----------- D Y N A M I C - Q U E S T I O N S -------------", AutoSize = true
            };

            flowLayout.Controls.Add(dyn);
            flowLayout.SetFlowBreak(dyn, true);
            QuizHelper.AddQuestionsToFlowLayout(aFatTemplate.GetDynamicFATQuestions, ref flowLayout, ref richTextBox1, ref aLogger, ref FinalQuestions);


            addanswersChkBox.CheckedChanged += (o, ee) =>
            {
                QuizHelper.SetAddAnswers(addanswersChkBox.Checked);
            };

            addquestionMaterialChkBox.CheckedChanged += (o, ee) =>
            {
                QuizHelper.SetAddAssets(addquestionMaterialChkBox.Checked);
            };
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog opendialog = new OpenFileDialog();
                opendialog.Filter       = "FCT Exam File Template (*.XML)|*.XML";
                opendialog.DefaultExt   = "XML";
                opendialog.AddExtension = true;

                if (opendialog.ShowDialog() == DialogResult.OK)
                {
                    anExam = SerializationHelper.DeserializeXML <Exam>(File.ReadAllText(opendialog.FileName));

                    foreach (var q in anExam.QuestionsList)
                    {
                        QuizHelper.AddQuestionTortb(ref rtb, q.QuestionNumber, q, true, true);
                    }
                    anExam.EncryptAnswerandExplanation(instructorPassTxtBox.Text);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.selected_topic);

            //Reference
            quizTopicTextView       = (TextView)FindViewById(Resource.Id.quizTopicTest);
            quizDescriptionTextView = (TextView)FindViewById(Resource.Id.quizDescriptionText);
            quizImageView           = (ImageView)FindViewById(Resource.Id.quizImage);
            quizStartButton         = (Button)FindViewById(Resource.Id.quizStartButton);


            //GET TOPIC NAME
            quizTopic = Intent.GetStringExtra("topic");
            quizTopicTextView.Text = quizTopic;

            //Retrieve topic description
            QuizHelper quizHelper = new QuizHelper();

            quizDescriptionTextView.Text = quizHelper.GetTopicDescription(quizTopic);
            quizStartButton.Click       += QuizStartButton_Click;

            //GET IMAGE
            quizImageView.SetImageResource(GetImage(quizTopic));
        }
예제 #6
0
        private static void GradeExamQuestion(ref RichTextBox rtb, bool addLogs, string studentPass, string instructorPassword, Exam anExam)
        {
            var id   = AESGCM.SimpleDecryptWithPassword(anExam.RequiredStudentDetails.StudentID, studentPass);
            var name = AESGCM.SimpleDecryptWithPassword(anExam.RequiredStudentDetails.StudentName, studentPass);

            rtb.AppendText($"{anExam.ExamDescription}\n", new System.Drawing.Font("Courier New", 16, System.Drawing.FontStyle.Bold));
            rtb.AppendText($"Student Name: {name}\n", new System.Drawing.Font("Courier New", 16, System.Drawing.FontStyle.Bold));
            rtb.AppendText($"Student ID: {id}\n", new System.Drawing.Font("Courier New", 16, System.Drawing.FontStyle.Bold));
            rtb.AppendText($"Grade: {anExam.GetExamGrade(instructorPassword)}\n", new System.Drawing.Font("Courier New", 18, System.Drawing.FontStyle.Underline));
            // rtb.AppendText($"Exam Sent to Student Date and Comment:{list[i].weSentHimExamDateAndDetails}", new System.Drawing.Font("Courier New", 12, System.Drawing.FontStyle.Italic));
            // rtb.AppendText($"Student Exam Submission Date And Comment:{list[i].weSentHimExamDateAndDetails}", new System.Drawing.Font("Courier New", 12, System.Drawing.FontStyle.Italic));

            foreach (var q in anExam.QuestionsList)
            {
                QuizHelper.AddGradedQuestionToRtb(ref rtb, q.QuestionNumber, q, instructorPassword, true, true);
            }

            if (addLogs)
            {
                rtb.AppendText(System.Environment.NewLine);
                rtb.AppendText($"***** Student Exam Logs *****\n", new System.Drawing.Font("Courier New", 18, System.Drawing.FontStyle.Italic));

                foreach (var s in anExam?.ExamLog)
                {
                    rtb.AppendText($"{s}\n", new System.Drawing.Font("Courier New", 8, System.Drawing.FontStyle.Regular));
                }
            }
            rtb.AppendText($"***** END OF STUDENT {name} EXAM *****\n", new System.Drawing.Font("Courier New", 18, System.Drawing.FontStyle.Italic));
            rtb.AddNewPage();
        }
예제 #7
0
        public void PassFailEmoji()
        {
            //arrange
            var qz = new QuizHelper();

            //act
            var pass = qz.GetPassFail(74);
            var fail = qz.GetPassFail(73);

            //assert
            Assert.Equal(":white_check_mark:", pass);
            Assert.Equal(":no_entry_sign:", fail);
        }
예제 #8
0
        void ConnectViews()
        {
            quizTopicText   = (TextView)FindViewById(Resource.Id.quizTopicText);
            descriptionText = (TextView)FindViewById(Resource.Id.quizDescriptionText);
            quizImage       = (ImageView)FindViewById(Resource.Id.quizImage);
            startQuizButton = (Button)FindViewById(Resource.Id.startQuizButton);

            quizTopic          = Intent.GetStringExtra("topic");
            quizTopicText.Text = quizTopic;

            QuizHelper quizHelper = new QuizHelper();

            descriptionText.Text = quizHelper.GetTopicDescription(quizTopic);

            startQuizButton.Click += StartQuizButton_Click;
        }
예제 #9
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string tmpAnswer = answerBox.Text.ToLower();

            if (tmpAnswer.Equals(answer))
            {
                QuizHelper qh = new QuizHelper();
                qh.solved(quiz);
                MessageBox.Show("Success, Your answer is true!");
                NavigationService.GoBack();
            }
            else
            {
                MessageBox.Show("Sorry, your answer apparently wrong");
            }
        }
예제 #10
0
        public IActionResult SelectAnswers(List <QuizAnswersVM> resultQuiz)
        {
            var correctQuizAnswers = QuizHelper.GetAllCorrectQuizAnswers();
            List <QuizCorrectAnswerVM> finalResultQuiz = new List <CCWordBoard.ViewModel.QuizCorrectAnswerVM>();

            foreach (QuizAnswersVM answer in resultQuiz)
            {
                QuizCorrectAnswerVM result = correctQuizAnswers.Where(a => a.QuizQuestionId == answer.QuizQuestionID).Select(a => new QuizCorrectAnswerVM()
                {
                    QuizQuestionID    = a.QuizQuestionId,
                    QuizAnswerCorrect = a.QuizAnswerText,
                    isCorrect         = (answer.QuizAnswerText).Equals(a.QuizAnswerText)
                }).FirstOrDefault();

                finalResultQuiz.Add(result);
            }

            return(Json(new { result = finalResultQuiz }));
        }
예제 #11
0
 public CatchTheGame()
 {
     InitializeComponent();
     Loaded += (s, e) =>
     {
         IOHelper io      = new IOHelper();
         string   profile = io.Read("profile.json");
         if (profile.Equals(""))
         {
             io.Write("profile.json", JsonConvert.SerializeObject(new Profile()
             {
                 QuizContent  = new QuizContent(),
                 SolvedCount  = 0,
                 SolvedQuizes = new List <string>()
             }));
             profile = io.Read("profile.json");
         }
         QuizHelper qh = new QuizHelper();
         System.Diagnostics.Debug.WriteLine(qh.getProfileString());
     };
 }
예제 #12
0
        public void EmjoiFromNumber()
        {
            // arrange
            var qz = new QuizHelper();

            // act
            var one      = qz.GetNumberEmojiFromInt(1);
            var two      = qz.GetNumberEmojiFromInt(2);
            var three    = qz.GetNumberEmojiFromInt(3);
            var four     = qz.GetNumberEmojiFromInt(4);
            var five     = qz.GetNumberEmojiFromInt(5);
            var six      = qz.GetNumberEmojiFromInt(6);
            var seven    = qz.GetNumberEmojiFromInt(7);
            var eight    = qz.GetNumberEmojiFromInt(8);
            var nine     = qz.GetNumberEmojiFromInt(9);
            var zero     = qz.GetNumberEmojiFromInt(0);
            var ten      = qz.GetNumberEmojiFromInt(10);
            var eleven   = qz.GetNumberEmojiFromInt(11);
            var twelve   = qz.GetNumberEmojiFromInt(12);
            var thirteen = qz.GetNumberEmojiFromInt(13);
            var fourteen = qz.GetNumberEmojiFromInt(14);

            // assert
            Assert.Equal(":one:", one);
            Assert.Equal(":two:", two);
            Assert.Equal(":three:", three);
            Assert.Equal(":four:", four);
            Assert.Equal(":five:", five);
            Assert.Equal(":six:", six);
            Assert.Equal(":seven:", seven);
            Assert.Equal(":eight:", eight);
            Assert.Equal(":nine:", nine);
            Assert.Equal(":zero:", zero);
            Assert.Equal(":one::zero:", ten);
            Assert.Equal(":one::one:", eleven);
            Assert.Equal(":one::two:", twelve);
            Assert.Equal(":one::three:", thirteen);
            Assert.Equal(":one::four:", fourteen);
        }
예제 #13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            SetContentView(Resource.Layout.selected_topic);

            // Selected Topic Setup

            quizTopicTextView   = (TextView)FindViewById(Resource.Id.quizTopicText);
            descriptionTextView = (TextView)FindViewById(Resource.Id.quizDescriptionText);
            quizImageView       = (ImageView)FindViewById(Resource.Id.quizImage);
            startQuizButton     = (Button)FindViewById(Resource.Id.startQuizButton);


            quizTopic = Intent.GetStringExtra("Topic");
            quizTopicTextView.Text = quizTopic;
            quizImageView.SetImageResource(GetImage(quizTopic));

            // Fetching Quiz Description from Quiz Helpers
            QuizHelper quizHelper = new QuizHelper();

            descriptionTextView.Text = quizHelper.GetTopicDescription(quizTopic);
            startQuizButton.Click   += StartQuizButton_Click;
        }
예제 #14
0
        public IActionResult SelectAnswers()
        {
            QuizHelper.LoadDataFromFile(".//Data//Questions.txt");
            var quizQuestions  = QuizHelper.GetAllQuizQuestions();
            var rawQuizAnswers = QuizHelper.GetAllQuizAnswers();

            IQueryable <QuizQuestionsVM> questionsInclAnswers = null;

            questionsInclAnswers = quizQuestions.Where(q => q.QuizQuestionId != null)
                                   .Select(q => new QuizQuestionsVM
            {
                VMQuizQuestionId   = q.QuizQuestionId,
                VMQuizQuestionText = q.QuizQuestionText,
                VMQuizAnswers      = rawQuizAnswers.Where(a => a.QuizQuestionId == q.QuizQuestionId)
                                     .Select(c => new QuizAnswersVM {
                    QuizAnswerId   = c.QuizAnswerId,
                    QuizAnswerText = c.QuizAnswerText,
                    QuizQuestionID = c.QuizQuestionId
                }).ToList()
            }).AsQueryable();


            return(View(questionsInclAnswers));
        }
예제 #15
0
        public static void AddQuestionToFlowLayout(ref FlowLayoutPanel flowlayout, ref Logger logger, ref Exam anExam,
                                                   ref RichTextBox assetsrtb, ref List <string> anexamLog)
        {
            Logger        aLogger = logger;
            List <string> ExamLog = anexamLog;

            for (int i = 0; i < anExam.QuestionsList.Count; i++)
            {
                var question       = anExam.QuestionsList[i];
                var questionNumber = question.QuestionNumber;
                QuizHelper.AddQuestionTortb(ref assetsrtb, questionNumber, question, true, false);

                Label question1Lbl = new Label();
                question1Lbl.Text     = $"Q{questionNumber}. " + question.ToString();
                question1Lbl.AutoSize = true;
                question1Lbl.Font     = new Font("Courier New", 12, FontStyle.Bold);

                flowlayout.Controls.Add(question1Lbl);
                if (question.GetType() == typeof(MultipleChoiceQuestion))
                {
                    GroupBox gb = new GroupBox();
                    gb.Location     = new Point(5, 20);
                    gb.MinimumSize  = new Size(100, 30);
                    gb.AutoSize     = true;
                    gb.AutoSizeMode = AutoSizeMode.GrowOnly;
                    gb.Text         = "Choices";
                    gb.Tag          = questionNumber;

                    int lastpos = 0;
                    for (int j = 0; j < question.Choices.Count; j++)
                    {
                        var option = question.Choices[j];

                        RadioButton rb = new RadioButton();
                        rb.Location        = new Point(7, lastpos += 20);
                        rb.AutoSize        = true;
                        rb.Text            = option;
                        rb.Font            = new Font("Courier New", 12, FontStyle.Bold);
                        rb.CheckedChanged += (s, ee) =>
                        {
                            var rbb = s as RadioButton;
                            if (rbb == null)
                            {
                                return;
                            }
                            if (rbb.Checked)
                            {
                                question.StudentAnswer = rbb.Text;
                                aLogger.LogMessage($"[Answer Update for Question {questionNumber}.] [{question.ToString()}]  updated,  student answer = {question.StudentAnswer.ToString()}", LogMsgType.Verbose);
                                ExamLog.Add($"[{DateTime.Now}] [Answer Update for Question {questionNumber}.] [{question.ToString()}]  updated,  student answer = {question.StudentAnswer.ToString()}");
                            }
                        };

                        gb.Controls.Add(rb);
                    }
                    flowlayout.Controls.Add(gb);
                    flowlayout.SetFlowBreak(gb, true);
                }
                else if (question.GetType() == typeof(TrueFalseQuestion))
                {
                    GroupBox gb = new GroupBox();
                    gb.Location     = new Point(5, 20);
                    gb.MinimumSize  = new Size(100, 50);
                    gb.AutoSize     = true;
                    gb.AutoSizeMode = AutoSizeMode.GrowOnly;
                    gb.Text         = "Choices";


                    RadioButton rbt = new RadioButton();
                    rbt.Location = new Point(7, 20);
                    rbt.AutoSize = true;
                    rbt.Text     = true.ToString();
                    rbt.Font     = new Font("Courier New", 12, FontStyle.Bold);

                    rbt.CheckedChanged += (s, ee) =>
                    {
                        var rbb = s as RadioButton;
                        if (rbb == null)
                        {
                            return;
                        }
                        if (rbb.Checked)
                        {
                            question.StudentAnswer = rbb.Text;
                            aLogger.LogMessage($"[Answer Update for Question {questionNumber}.] [{question.ToString()}]  updated,  student answer = {question.StudentAnswer.ToString()}", LogMsgType.Verbose);
                            ExamLog.Add($"[{DateTime.Now}] [Answer Update for Question {questionNumber}.] [{question.ToString()}]  updated,  student answer = {question.StudentAnswer.ToString()}");
                        }
                    };

                    gb.Controls.Add(rbt);

                    RadioButton rbf = new RadioButton();
                    rbf.Location        = new Point(7, 40);
                    rbf.AutoSize        = true;
                    rbf.Text            = false.ToString();
                    rbf.Font            = new Font("Courier New", 12, FontStyle.Bold);
                    rbf.CheckedChanged += (s, ee) =>
                    {
                        var rbb = s as RadioButton;
                        if (rbb == null)
                        {
                            return;
                        }
                        if (rbb.Checked)
                        {
                            question.StudentAnswer = rbb.Text;
                            aLogger.LogMessage($"[Answer Update for Question {questionNumber}.] [{question.ToString()}]  updated,  student answer = {question.StudentAnswer.ToString()}", LogMsgType.Verbose);
                            ExamLog.Add($"[{DateTime.Now}] [Answer Update for Question {questionNumber}.] [{question.ToString()}]  updated,  student answer = {question.StudentAnswer.ToString()}");
                        }
                    };
                    gb.Controls.Add(rbf);


                    flowlayout.Controls.Add(gb);
                    flowlayout.SetFlowBreak(gb, true);
                }
                else if (question.GetType() == typeof(ValueInputQuestion))
                {
                    TextBox tb = new TextBox();
                    tb.Width        = 100;
                    tb.TextChanged += (s, ee) =>
                    {
                        question.StudentAnswer = tb.Text;
                        aLogger.LogMessage($"[Answer Update for Question {questionNumber}.] [{question.ToString()}]  updated,  student answer = {question.StudentAnswer.ToString()}", LogMsgType.Verbose);
                        ExamLog.Add($"[{DateTime.Now}] [Answer Update for Question {questionNumber}.] [{question.ToString()}]  updated,  student answer = {question.StudentAnswer.ToString()}");
                    };
                    flowlayout.Controls.Add(tb);
                    flowlayout.SetFlowBreak(tb, true);
                }
            }
        }
예제 #16
0
        public HelperTest()
        {
            Sutr = new RoleHelper(new AquaLearnIMDbContext());
            Sutt = new TrashHelper(new AquaLearnIMDbContext());
            Sutf = new FishHelper(new AquaLearnIMDbContext());
            Sutp = new PlantHelper(new AquaLearnIMDbContext());
            Suth = new HazardHelper(new AquaLearnIMDbContext());
            Sute = new ExhibitHelper(new AquaLearnIMDbContext());
            Sutu = new UserHelper(new AquaLearnIMDbContext());
            Sutq = new QuizHelper(new AquaLearnIMDbContext());
      
            role = new Role()
            {
                Name = "Teacher"
            };

            trash = new Trash()
            {
                Name = "Plastic Bottles",
                Schooling = true,
                Description = "Americans throw away 35 billion plastic water bottles every year.Making the ocean inhabitable for sea creatures."
            };

            fish = new Fish()
            {
                Name = "Shark",
                Schooling = false,
                Description = "Sharks are the most threatening predators in the ocean.",
                WaterType = new WaterType()
                {
                    WaterTypeId = 4,
                    Name = "Ocean Salt Water"
                }
            };
      
            plant = new Plant()
            {
                Name = "Algae",
                Description = "Algae are very diverse and found almost everywhere on the planet. They play an important role in many ecosystems, including providing the foundation for the aquatic food chains supporting all fisheries in the oceans and inland, as well as producing about 70 percent of all the air we breathe."
            };

            hazard = new Hazard()
            {
                Name = "Plastic",
                Description = "Pollution"
            };

            exhibit = new Exhibit()
            {
                Name = "Deep Sea",
            };

            user = new User()
            {
                Username = "******",
                Password = "******",
                ClassroomId = 22
            };

            quiz = new Quiz()
            {
               Name="Quiz"
            };

            Sutr.SetRole(role);
            Sutt.SetTrash(trash);
        }