Esempio n. 1
0
        /// <summary>
        /// Adds latecomers to the current test session
        /// </summary>
        /// <param name="Latecomers">People to add</param>
        public void AddLateComers(List <ClientModel> Latecomers)
        {
            if (!IsTestInProgress)
            {
                return;
            }

            var packageWithTest = DataPackage.TestPackage(CurrentTest);
            var packageWithArgs = DataPackage.StartTestPackage(TestStartupArgs);

            // Based on the arguments set the timer offset
            TestStartupArgs.TimerOffset = CurrentTest.Info.Duration - TimeLeft;

            // Add clients to the test
            foreach (var client in Latecomers)
            {
                ClientsInTest.Add(client);

                IoCServer.Network.Send(client, packageWithTest);

                IoCServer.Network.Send(client, packageWithArgs);

                client.ResetForNewTest(CurrentTest.Questions.Count);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Sets the clients that will be taking the test
        /// </summary>
        /// <param name="ClientsToAdd">The clients that will take the test</param>
        public void AddClients(List <ClientModel> ClientsToAdd)
        {
            if (IsTestInProgress)
            {
                // Use add latecommers method in this case
                return;
            }

            // Clear the list
            ClientsInTest.Clear();

            foreach (var client in ClientsToAdd)
            {
                if (client.CanStartTest)
                {
                    ClientsInTest.Add(client);
                }
            }
        }