Inheritance: MonoBehaviour
コード例 #1
0
        private void MonitorProgram()
        {
            _currentSegmentNode.OnNext(_currentProgramSettings.Segments.First);
            _currentSessionSettings = _currentSegmentNode.Value?.Value;
            while (_currentSessionSettings != null)
            {
                _currentSegmentProgress = new SessionProgress(_currentSessionSettings);
                _programProgress.SessionProgress.Add(_currentSegmentProgress);

                // Run the current segment
                Task.Run(() => MonitorSegment(), mSessionMonitorToken.Token).Wait();

                // move to next segment
                _currentSegmentNode.OnNext(_currentSegmentNode.Value.Next);
                _currentSessionSettings = _currentSegmentNode.Value?.Value;
            }
        }
コード例 #2
0
        public IActionResult Index(int groupId, int sessionId)
        {
            //Get assignment from repo
            Assignment assignment = _bobSessionRepository.GetNextAssignment(sessionId, groupId);

            //If their is no assignment found it can mean 2 things
            if (assignment == null)
            {
                //You cheated by deleting the cookie
                if (groupId == 0 || sessionId == 0)
                {
                    return(RedirectToAction("Index", "Session"));
                }
                //You completed all the assignments
                return(View("EndScreen"));
            }

            //Retrieve current progress from repo
            SessionProgress progress   = _bobSessionRepository.GetCompletionPercentage(sessionId, groupId);
            double          percentage = progress.getSessionProgress();

            ViewData["qamount"]    = progress.Current + "/" + progress.Total;
            ViewData["percentage"] = (int)percentage;

            //If the assignment is answered but not yet fully completed. Redirect to action Action
            if (assignment.Status == AssignmentStatus.WaitingForCode)
            {
                return(RedirectToAction("Action", new RouteValueDictionary
                {
                    { "referenceNumber", assignment.ReferenceNr }
                }));
            }

            //Show the assignment
            return(View(assignment));
        }