예제 #1
0
        private Classes.Test RandomazeQuestion(Classes.Test selectedTest, int numberOfQst)
        {
            Classes.Test result = new Classes.Test();
            result.Name = selectedTest.Name;

            Random rnd = new Random();

            int[] oldCounts = new int[0];
            int   currentCount;

            for (int i = 0; i < numberOfQst; i++)
            {
                currentCount = rnd.Next(0, numberOfQst - 1);
                for (int j = 0; j < oldCounts.Length; j++)
                {
                    if (currentCount == oldCounts[j])
                    {
                        j            = -1;
                        currentCount = rnd.Next(0, numberOfQst);
                    }
                }

                Array.Resize(ref oldCounts, oldCounts.Length + 1);
                oldCounts[oldCounts.Length - 1] = currentCount;

                result.Questions.Add(selectedTest.Questions[currentCount]);
            }

            return(result);
        }
예제 #2
0
        public ExaminationScreen(Classes.Test test)
        {
            InitializeComponent();

            Title = test.Name;

            _test          = (Classes.Test)Clone(test);
            _customAnswers = (List <Classes.Question>)Clone(test.Questions);

            UncheckedAnswers(_customAnswers);

            GenerateHeader(test.Name);
            GenerateRadioButton(test.Questions.Count);
        }