// From Teacher Panel public void ProcessCommand() { if (Navigation != null) { Debug.WriteLine("CHosen Student" + Navigation); GlobalFlowControl.Lesson.ChosenStudent = Navigation; //BaseHelper.Go(Navigation); } if (Movement != null) { BaseHelper.DoBaseMovements(Movement); } if (Gesture != null) { UpperBodyHelper.DoGestures(Gesture); } if (Chatbot != null) { } if (LessonStatus != null) { Debug.WriteLine(LessonStatus + " Lesson Status"); if (LessonStatus == "StopQuestion") { GlobalFlowControl.Lesson.StartingQuiz = false; } } if (SpecialAction != null) { Debug.WriteLine("Special Action : " + SpecialAction); string thing = SpecialAction.Split('-')[0]; string info = SpecialAction.Split('-')[1]; if (thing == "Emotion") { GlobalFlowControl.Lesson.StudentFeedbackReceived = true; double sadPc = double.Parse(info.Split(';')[0]); double neutralPc = double.Parse(info.Split(';')[1]); double happyPc = double.Parse(info.Split(';')[2]); AnalyzeEmotion(happyPc, sadPc, neutralPc); } } if (AssessPerformance != null) { AskRandomStudent(AssessPerformance); } }
public static void MoveDuringLesson() { var rdm = new Random(); Task.Factory.StartNew(() => { do { if (GlobalFlowControl.Navigation.Moving) { UpperBodyHelper.ResetAll(); Thread.Sleep(1000); // Reduce too-busy-waiting } else { for (int i = 1; i <= 6; i++) { UpperBodyHelper.MoveRandomly(i, 0.7); } int headMovementRdm = rdm.Next(2); if (headMovementRdm == 0) { UpperBodyHelper.Head.Left(); } else { UpperBodyHelper.Head.Right(); } if (GlobalFlowControl.Lesson.Starting == false) { break; } if (GlobalFlowControl.Navigation.Moving) { UpperBodyHelper.ResetAll(); } else { Wait(4000); } } } while (GlobalFlowControl.Lesson.Starting); UpperBodyHelper.ResetAll(); }); }
private void Form3_Shown(object sender, EventArgs e) { this.CenterToScreen(); this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; var area = Screen.FromControl(this).WorkingArea; picBackground.Location = new Point(0, 0); picBackground.Size = new Size(area.Width, area.Height); SystemUpdateHelper.Start(); SystemUpdateHelper.SystemUpdated += SystemUpdateHelper_SystemUpdated; InitSpeechAndChatbot(); UpperBodyHelper.Init(); BaseHelper.Connect(); }
private void CommandHandler() { var quiz = new Quiz(); for (commandIteration = 0; commandIteration < _commands.Count; commandIteration++) { while (LessonHelper.PauseRequested) { Thread.Sleep(500); } CurrentCommand = _commands[commandIteration]; var cmd = CurrentCommand.Type; var val = CurrentCommand.Value; UpdateCommand(cmd.ToLower(), val); Debug.WriteLine(cmd + "/" + val); switch (cmd.ToLower()) { case "speak": Speak(val); break; case "speakasync": SpeakAsync(val); break; case "playaudio": AudioHelper.PlayAudio(val); break; case "myspeech": MySpeech(val); break; case "myspeechasync": MySpeechAsync(val); break; case "move": Move(val); break; case "wait": Wait(Convert.ToInt32(val)); break; case "playmedia": PlayMedia(val); break; case "quizformat": quiz.QuizFormat = val; break; case "answer": quiz.Answer = val; break; case "timeout": quiz.TimeOut = val; break; case "gesture": UpperBodyHelper.DoGestures(val); break; case "start": if (val.ToLower() == "quiz") { LessonHelper.QuestionNumber += 1; quiz.QuestionNumber = LessonHelper.QuestionNumber; StartQuiz(quiz); LessonStatusHelper.LessonStatus.CurQuiz = null; //Wait(Convert.ToInt32(quiz.TimeOut) * 1000 + QUIZ_BUFFER_SECONDS * 1000); Wait(QUIZ_BUFFER_SECONDS * 800); // This QUIZ BUFFER TO give extra time for all student submit the answer Debug.WriteLine("Stopping quiz"); StopQuiz(); Wait(QUIZ_BUFFER_SECONDS * 1000); var now = DateTime.Now; Debug.WriteLine(now + " : QUIZ COMPLETED"); // This QUIZ BUFFER TO give extra time for teacher send student result to robot } else if (val.ToLower() == "emotion-survey") { TakeEmotionSurvey(); } break; case "gountil": BaseHelper.GoUntilReachedGoalOrCanceled(val); break; case "asking": var status = LessonStatusHelper.LessonStatus; if (Convert.ToInt32(val) == 1) { status.LessonState = "asking"; } else { status.LessonState = "notAsking"; } WebHelper.UpdateStatus(status); Wait(1500); break; case "lesson": if (val == "pause") { LessonHelper.SendPausedStatusToServer("paused"); LessonHelper.PauseLesson(); } else if (val == "continue") { LessonHelper.SendPausedStatusToServer("resumed"); LessonHelper.ResumeLesson(); } break; case "robot": if (val == "pickup-std") { RandomAskStudentQuestion(); } break; default: //MessageBox.Show($"Unknown Type: {cmd}"); break; } } }