public void HandleQuestion(QAQuestion msg)
        {
            try
            {
                ListViewItem lv = listNotAnswered.Items.Insert(0, msg.QID.ToString());
                lv.SubItems.Add(msg.senderProfile.Name);
                lv.Tag       = msg.Question;
                msg.Question = msg.Question.Replace("\r", " ");
                msg.Question = msg.Question.Replace("\n", " ");
                if (msg.Question.Length > 25)
                {
                    msg.Question = msg.Question.Substring(0, 25);
                }
                lv.SubItems.Add(msg.Question);

                QuestionObject qa = new QuestionObject();
                qa.QID         = msg.QID;
                qa.Question    = msg.Question;
                qa.RecipientID = msg.senderProfile.ClientId;
                qa.senderName  = msg.senderProfile.Name;

                lv.Tag = qa;
            }
            catch (Exception exp)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("QuestionAnswerPresenter.cs line==> 600", exp, null, false);
            }
        }
        public QuestionObject Clone()
        {
            QuestionObject qa = new QuestionObject();

            qa.Question    = Question;
            qa.QID         = QID;
            qa.RecipientID = RecipientID;
            qa.senderName  = senderName;
            qa.Answers     = Answers;

            return(qa);
        }
        void ShowAnsweredQuestions(int answered_index)
        {
            string str = "";

            try
            {
                if (answered_index == 0)
                {
                    listAnswered.Items[0].Selected = true;
                    //nIndex = 0;
                }


                if (listAnswered.SelectedItems.Count < 1)
                {
                    return;
                }

                int nIndex = 0;

                if (answered_index == 0)
                {
                    nIndex = listAnswered.Items[0].Index;
                    //nIndex = 0;
                }
                else
                {
                    nIndex = listAnswered.SelectedItems[0].Index;
                }


                QuestionObject obj = (QuestionObject)listAnswered.Items[nIndex].Tag;
                listPrevious.Items.Clear();
                for (int i = 0; i < obj.Answers.Count; i++)
                {
                    //ListViewItem lv = listPrevious.Items.Add(obj.Answers[i].ToString());
                    str = obj.Answers[i].ToString();
                    str = str.Replace("\r", " ");
                    str = str.Replace("\n", " ");

                    ListViewItem lv = listPrevious.Items.Add(str);
                    lv.Tag = obj.Answers[i].ToString();
                }
            }
            catch (Exception exp)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("QuestionAnswerPresenter.cs line==> 632", exp, null, false);
            }
        }
Ejemplo n.º 4
0
        public QuestionObject Clone()
        {
            QuestionObject qa = new QuestionObject();
            qa.Question = Question;
            qa.QID = QID;
            qa.RecipientID	= RecipientID;
            qa.senderName = senderName;
            qa.Answers = Answers;

            return qa;
        }
Ejemplo n.º 5
0
        public void HandleQuestion(QAQuestion msg)
        {
            try
            {
                ListViewItem lv =  listNotAnswered.Items.Insert(0,msg.QID.ToString());
                lv.SubItems.Add(msg.senderProfile.Name);
                lv.Tag = msg.Question;
                msg.Question = msg.Question.Replace("\r"," ");
                msg.Question = msg.Question.Replace("\n"," ");
                if(msg.Question.Length > 25)
                    msg.Question = msg.Question.Substring(0,25);
                lv.SubItems.Add(msg.Question);

                QuestionObject qa = new QuestionObject();
                qa.QID = msg.QID;
                qa.Question = msg.Question;
                qa.RecipientID = msg.senderProfile.ClientId;
                qa.senderName = msg.senderProfile.Name;

                lv.Tag = qa;
            }
            catch(Exception exp)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("QuestionAnswerPresenter.cs line==> 600",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);
            }
        }