Exemplo n.º 1
0
        /// <summary>
        /// Constructs the viewmodel and loads it's properties with the given data
        /// </summary>
        /// <param name="results">Data to be loaded</param>
        public TestResultsDetailsViewModel(ServerTestResults results)
        {
            // Create commands
            CreateCommands();

            // Load given data
            LoadData(results);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads this viewmodel with given data
        /// </summary>
        /// <param name="value"></param>
        private void LoadData(ServerTestResults value)
        {
            if (value == null)
            {
                return;
            }

            StudentsViewData = value.Clients;
            mTestResults     = value;

            CreateQuestionsViewData();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Loads viewmodel properties with the given test resuts object
        /// </summary>
        /// <param name="value"></param>
        private void LoadViewModel(ServerTestResults value)
        {
            if (value == null)
            {
                return;
            }

            ResultsDateDay      = value.Date.ToShortDateString();
            ResultsDateHour     = value.Date.ToShortTimeString();
            TestName            = value.Test.Info.Name;
            TestAttendeesNumber = value.ClientAnswers.Count.ToString();;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Saves results to the file
        /// </summary>
        private void SaveResults()
        {
            Results = new ServerTestResults()
            {
                Date = DateTime.Now,
                Test = CurrentTest,
                SessionIdentifier = TestStartupArgs.SessionIdentifier,
            };

            foreach (var client in ClientsInTest)
            {
                Results.ClientAnswers.Add(new TestResultsClientModel(client)
                {
                    PointsScored   = client.PointsScored,
                    Mark           = client.Mark,
                    QuestionsOrder = client.QuestionsOrder,
                }, client.Answers);
            }

            ResultsFileWriter.WriteToFile(Results);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Fired when an item is selected from the list
 /// </summary>
 /// <param name="item">Item that has been selected</param>
 private void ListControl_ItemSelected(ServerTestResults item)
 {
     LoadViewModel(item);
     IsAnyItemSelected = true;
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="results">The results this viewmodel will be based on</param>
 /// <param name="index">THe index of this item in the list</param>
 public TestResultsListItemViewModel(ServerTestResults results, int index)
 {
     TestName = results.Test.Info.Name;
     Date     = results.Date.ToLongDateString();
     Index    = index;
 }