public VideoAssistance(Video v, Assistance a, int sv, int ev, Emotion.EmotionType t) { Video = v; Assistance = a; StartVideoTime = sv; EndVideoTime = ev; EmotionType = t; }
/// <summary> /// 处理双击ListBox条目播放事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PlayVideo_DoubleClick(object sender, MouseEventArgs e) { emotionModel.stopDectecting(); int idx = videoListBox.IndexFromPoint(e.Location); if (idx == ListBox.NoMatches) { return; } // 若上次会话尚未结束,首先清空上次会话 if (learningSession != null) { closeSession(); //learningSession.closeSession(); //mStoreModule.closeSession(learningSession); //// For Debug //Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(learningSession)); //learningSession = null; } curEmotion = Emotion.EmotionType.Normal; normalLabel.ForeColor = Color.Red; curLabel = normalLabel; videoListBox.SelectedIndex = idx; curVideoHelpMap = Repo.assistances[curVideoList[idx]]; //int idx = (sender as ListBox).SelectedIndex; curPlayFile = playList[idx]; resetBtns(); openSession(curPlayFile.FullName, username); //learningSession = LearningSession.createSession(curPlayFile.FullName, username); //mVideoModule.setSession(learningSession); //mStoreModule.openSession(learningSession); //// For Debug //Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(learningSession)); mVideoModule.playFile(curPlayFile, learningSession); normalBtn.Text = "暂停播放"; videoProgressTrackBar.SetRange(0, mVideoModule.getVideoDuration()); videoProgressTrackBar.Value = 0; videoProgressTimer.Start(); emotionThread = new Thread(emotionModel.startDectecting); emotionThread.Start(); }
/**************** Learning Session ****************/ public void updateUiAccordingToEmotion(Emotion.EmotionType emotion, double[] pro) { curEmotion = emotion; curLabel.ForeColor = Color.Black; curLabel = labelMap[curEmotion]; curLabel.ForeColor = Color.Red; List <VideoAssistance> helpList = curVideoHelpMap[emotion]; foreach (VideoAssistance va in helpList) { Assistance assistance = va.Assistance; switch (assistance.assistanceType) { case Assistance.AssistanceType.Book: book1.Load(Environment.CurrentDirectory + "\\bookimages\\" + ((BookAssistance)assistance).PictureUrl); break; case Assistance.AssistanceType.Course: lowLevelCourse1.Text = ((CourseAssistance)assistance).Course.CourseName; highLevelCourse1.Text = ((CourseAssistance)assistance).Course.CourseName; break; case Assistance.AssistanceType.Text: helpTextLabel.Text = ((TextAssistance)assistance).TextInfo; break; } } amusedLabel.Text = "愉悦:" + pro[0].ToString("#0.00"); thinkingLabel.Text = "思考:" + pro[1].ToString("#0.00"); notetakingLabel.Text = "笔记:" + pro[2].ToString("#0.00"); confusedLabel.Text = "困惑:" + pro[3].ToString("#0.00"); surprisedLabel.Text = "惊讶:" + pro[4].ToString("#0.00"); distractedLabel.Text = "分心:" + pro[5].ToString("#0.00"); normalLabel.Text = "普通:" + pro[6].ToString("#0.00"); unknownLabel.Text = "未知:" + pro[7].ToString("#0.00"); concentratedLabel.Text = "专注:" + pro[8].ToString("#0.00"); }