public void HandleAnswer(QAAnswer msg) { int selected_index = 0; try { for (int i = 0; i < listQuestions.Items.Count; i++) { if (((AnswerObject)listQuestions.Items[i].Tag).QID == msg.QID) { listQuestions.Items[i].Selected = true; selected_index = i; AnswerObject answer = (AnswerObject)listQuestions.Items[i].Tag; answer.answersArray.Add(msg.Answer); answer.answersByArray.Add(msg.senderProfile.Name); break; } } showQuestionsAnswers(selected_index); //listQuestions.Items[selected_index].Selected=true; } catch (Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("QuestionAnswerAttendee.cs line==> 496", exp, null, false); } }
public void HandleAnswer(QAAnswer msg) { int selected_index=0; try { for(int i = 0 ; i < listQuestions.Items.Count ; i++) { if(((AnswerObject)listQuestions.Items[i].Tag).QID == msg.QID) { listQuestions.Items[i].Selected=true; selected_index=i; AnswerObject answer = (AnswerObject)listQuestions.Items[i].Tag; answer.answersArray.Add(msg.Answer); answer.answersByArray.Add(msg.senderProfile.Name); break; } } showQuestionsAnswers(selected_index); //listQuestions.Items[selected_index].Selected=true; } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("QuestionAnswerAttendee.cs line==> 496",exp,null,false); } }
public void button1_Click(object sender, System.EventArgs e) { //first locate if we are answering a virgin PC try { /* private void listNotAnswered_SelectedIndexChanged(object sender, System.EventArgs e) { if(listNotAnswered.SelectedItems.Count < 1) return; textQuestion.Text = ((QuestionObject)listNotAnswered.Items[listNotAnswered.SelectedItems[0].Index].Tag).Question; bAnsweringAlreadyAnswered = false; } */ // If The questions to be answered are clicked // this bool is set to false // If The questions not to be answered are clicked // this bool is set to true. // True goes into if==>If The questions to be answered are clicked if(!bAnsweringAlreadyAnswered) { if(listNotAnswered.SelectedItems.Count < 1) return; QuestionObject obj = (QuestionObject)listNotAnswered.SelectedItems[0].Tag; QAAnswer answerMessage = new QAAnswer(obj.QID,NetworkManager.getInstance().profile,obj.RecipientID); answerMessage.Answer = textAnswer.Text; answerMessage.Question = textQuestion.Text; NetworkManager.getInstance().SendLoadPacket(answerMessage); //now move the item to answered items ListViewItem lv = listAnswered.Items.Insert(0,answerMessage.QID.ToString()); lv.SubItems.Add(obj.senderName); lv.SubItems.Add(obj.Question); lv.Tag = obj.Clone(); listNotAnswered.Items.RemoveAt(listNotAnswered.SelectedItems[0].Index); obj = (QuestionObject)lv.Tag; obj.Answers.Add(textAnswer.Text); textAnswer.Text = ""; } else { if(listAnswered.SelectedItems.Count < 1) return; QuestionObject obj = (QuestionObject)listAnswered.SelectedItems[0].Tag; QAAnswer answerMessage = new QAAnswer(obj.QID,NetworkManager.getInstance().profile,obj.RecipientID); answerMessage.Answer = textAnswer.Text; answerMessage.Question = textQuestion.Text; NetworkManager.getInstance().SendLoadPacket(answerMessage); obj.Answers.Add(textAnswer.Text); textAnswer.Text = ""; } // It means 0 to be selected by default ShowAnsweredQuestions(0); textQuestion.Text=""; } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("QuestionAnswerPresenter.cs line==> 688",exp,null,false); } }
public void button1_Click(object sender, System.EventArgs e) { //first locate if we are answering a virgin PC try { /* * private void listNotAnswered_SelectedIndexChanged(object sender, System.EventArgs e) * { * if(listNotAnswered.SelectedItems.Count < 1) * return; * * textQuestion.Text = ((QuestionObject)listNotAnswered.Items[listNotAnswered.SelectedItems[0].Index].Tag).Question; * bAnsweringAlreadyAnswered = false; * } */ // If The questions to be answered are clicked // this bool is set to false // If The questions not to be answered are clicked // this bool is set to true. // True goes into if==>If The questions to be answered are clicked if (!bAnsweringAlreadyAnswered) { if (listNotAnswered.SelectedItems.Count < 1) { return; } QuestionObject obj = (QuestionObject)listNotAnswered.SelectedItems[0].Tag; QAAnswer answerMessage = new QAAnswer(obj.QID, NetworkManager.getInstance().profile, obj.RecipientID); answerMessage.Answer = textAnswer.Text; answerMessage.Question = textQuestion.Text; NetworkManager.getInstance().SendLoadPacket(answerMessage); //now move the item to answered items ListViewItem lv = listAnswered.Items.Insert(0, answerMessage.QID.ToString()); lv.SubItems.Add(obj.senderName); lv.SubItems.Add(obj.Question); lv.Tag = obj.Clone(); listNotAnswered.Items.RemoveAt(listNotAnswered.SelectedItems[0].Index); obj = (QuestionObject)lv.Tag; obj.Answers.Add(textAnswer.Text); textAnswer.Text = ""; } else { if (listAnswered.SelectedItems.Count < 1) { return; } QuestionObject obj = (QuestionObject)listAnswered.SelectedItems[0].Tag; QAAnswer answerMessage = new QAAnswer(obj.QID, NetworkManager.getInstance().profile, obj.RecipientID); answerMessage.Answer = textAnswer.Text; answerMessage.Question = textQuestion.Text; NetworkManager.getInstance().SendLoadPacket(answerMessage); obj.Answers.Add(textAnswer.Text); textAnswer.Text = ""; } // It means 0 to be selected by default ShowAnsweredQuestions(0); textQuestion.Text = ""; } catch (Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("QuestionAnswerPresenter.cs line==> 688", exp, null, false); } }