예제 #1
0
        public void Sys_SendText(int ClientId)
        {
            try
            {
                strText = txtBoxViewChat.Rtf;
                //Trace.WriteLine("strText" + strText.ToString());
                ///	Trace.WriteLine("index of string : " + strText.IndexOf(@"\viewkind4\uc1\pard\b\f0\fs20 Saif :\par").ToString());

                if(txtBoxViewChat.Text.Trim().ToString()=="")
                    return;
                //Trace.WriteLine("strText first message" + strText.Trim().ToString() + " txtBoxViewChat text property " +txtBoxViewChat.Text.ToString() );
                //	if(strText=="")return;
                WebMeeting.Client.NetworkManager network = WebMeeting.Client.NetworkManager.getInstance();

                IMChatMessage msg=new IMChatMessage();
                //Trace.WriteLine("before" + msg.MessageType.ToString());

                //msg.MessageType = (ushort)MessageObjectType.MsgIMChat;
                //Trace.WriteLine("after" + msg.MessageType.ToString());
                msg.senderID = network.profile.ClientId;

                if(testCombo.SelectedIndex == 1)
                    msg.m_ForClientType = ClientType.ClientPresenter;
                else if(testCombo.SelectedIndex == 2)
                    msg.m_ForClientType = ClientType.ClientAttendee;

                msg.RecipientId = ClientId;
                //msg.MessageType = (ushort)MessageObjectType.MsgIMChat;

                if(msg.RecipientId  == network.profile.ClientId)
                    return;

                //msg.sender= network.profile.Name;
                //network.profile.clientType=ClientType.ClientHost
                if(strText == "")
                {
                    return;
                }
                else
                    msg.IMMessage=strText;

                /*
                                IMChatMessage chatMsg = (IMChatMessage)msg;

                                for(int i = 0 ; i < Client.ClientUI.getInstance().chatWindowsArray.Count; i++)
                                {
                                    Client.ClientUI.ClientProfileWrapper CP =(Client.ClientUI.ClientProfileWrapper ) Client.ClientUI.getInstance().chatWindowsArray[i];
                                    if(CP.nUniqueID== chatMsg.RecipientId) //if found
                                    {
                                        //place the message in chat control message pump
                                        chatControl UserChatCtrl = (chatControl)CP.tabPage.Control;
                                        UserChatCtrl.messagePool.Add(msg);
                                        break;
                                    }
                                }

                                this.txtBoxPreviewChat.Font=this.txtBoxPreviewChat.SelectionFont;
                                txtBoxPreviewChat.Clear();
                                txtBoxPreviewChat.Focus();
                */
                //Trace.WriteLine("network.profile.clientType" +network.profile.clientType.ToString()+ " ClientType.ClientHost" +ClientType.ClientHost.ToString());
                if(network.profile.clientType==ClientType.ClientHost)
                    network.SendLoadPacket(msg);

            }

            catch(Exception exp)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("chatControl.cs ==>Sys_SendText( ==> 922",exp,exp.ToString()+" SendText",true);

            }
        }
예제 #2
0
        public void consumeFunction()
        {
            try
            {
                while(m_bIsActive)
                {
                    while(messagePool.Count>0)
                    {
                        try
                        {
                            try
                            {
                                if(Client.ClientUI.getInstance().chatTabControl.SelectedTab != thisWindowTabPage)
                                {
                                    Win32.USER32.SendMessage(this.Handle,100009,new IntPtr(),new IntPtr());
                                }
                            }
                            catch(Exception ex)
                            {
                                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Exception occur at message processing loop ",ex,null,false);
                            }
                            message=(IMChatMessage)messagePool[0];
                            ProcessMessage(message);
                            messagePool.RemoveAt(0);
                        }
                        catch(Exception ex)
                        {
                            WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Exception occur at message processing loop ",ex,null,false);
                        }
                    }
                    Thread.Sleep(100);
                }
            }
            catch(Exception exp)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("chatControl.cs ==>chatControl() ==> 232",exp,null,false);

            }
        }
예제 #3
0
        public void SendText(string str)
        {
            try
            {
                if((testCombo.SelectedIndex == 0)|| (testCombo.SelectedIndex == -1)||
                    (testCombo.SelectedIndex == 1) ||(testCombo.SelectedIndex == 2))
                {
                    WebMeeting.Client.NetworkManager network = WebMeeting.Client.NetworkManager.getInstance();

                    IMChatMessage msg=new IMChatMessage();
                    msg.senderID = network.profile.ClientId;

                    if(testCombo.SelectedIndex == 1)
                        msg.m_ForClientType = ClientType.ClientPresenter;
                    else if(testCombo.SelectedIndex == 2)
                        msg.m_ForClientType = ClientType.ClientAttendee;
                    if(nRecipientID == -1)
                    {
                        //MessageBox.Show("if(nRecipientID == -1)  --------TRUE");
                        //Trace.WriteLine("Recipient ID is -1");
                        if(testCombo.Visible == false)
                        {
                            //	Trace.WriteLine("if(testCombo.Visible == false) is true");
                            //	Trace.WriteLine("Client.ClientUI.getInstance().sendTo.SelectedIndex : " + Client.ClientUI.getInstance().sendTo.SelectedIndex.ToString() ) ;
                            if(Client.ClientUI.getInstance().sendTo.SelectedIndex != -1)
                            {
                                msg.RecipientId = ((ClientProfile)Client.ClientUI.getInstance().arrayParticipents[Client.ClientUI.getInstance().sendTo.SelectedIndex]).ClientId;
                                msg.MessageType = (ushort)MessageObjectType.MsgIMChat;

                            }
                        }
                    }
                    else
                    {
                        //MessageBox.Show("if(nRecipientID == -1)  --------FALSE");
                        //Trace.WriteLine("Else condition is run");
                        msg.RecipientId = nRecipientID;
                        msg.MessageType = (ushort)MessageObjectType.MsgIMChat;
                        //Trace.WriteLine(msg.MessageType.ToString()) ;
                    }

                    if(msg.RecipientId  == network.profile.ClientId)
                        return;

                    msg.sender= network.profile.Name;
                    msg.ConferenceID = network.profile.ConferenceID; //conf used in transcript

                    if(str == "")
                    {
                        msg.IMMessage=txtBoxPreviewChat.Rtf;
                        if(txtBoxPreviewChat.Text.Length==0)
                            return;

                    }
                    else
                        msg.IMMessage=str;

                    if((Client.ClientUI.getInstance().sendTo.SelectedIndex != -1) && (testCombo.Visible == false))
                    {

                        IMChatMessage chatMsg = (IMChatMessage)msg;

                        bool found = false;
                        for(int i = 0 ; i < Client.ClientUI.getInstance().chatWindowsArray.Count; i++)
                        {
                            Client.ClientUI.ClientProfileWrapper CP =(Client.ClientUI.ClientProfileWrapper ) Client.ClientUI.getInstance().chatWindowsArray[i];
                            if(CP.nUniqueID== chatMsg.RecipientId) //if found
                            {
                                //place the message in chat control message pump
                                chatControl UserChatCtrl = (chatControl)CP.tabPage.Control;
                                UserChatCtrl.messagePool.Add(msg);
                                found = true;
                                break;
                            }
                        }

                        if(!found)
                        {
                            // if no chat window found. create a new tab page .. add it to tab control
                            Client.ClientUI.getInstance().CreateChildControl(msg);
                        }
                    }
                    else
                    {
                        messagePool.Add(msg);
                    }
                    this.txtBoxPreviewChat.Font=this.txtBoxPreviewChat.SelectionFont;
                    txtBoxPreviewChat.Clear();
                    txtBoxPreviewChat.Focus();
                    //Trace.WriteLine("main chat " + msg.MessageType.ToString());
                    network.SendLoadPacket(msg);
                }
                else
                {
                    int priMsgRecIndex=-1;
            //					if(((WebMeeting.Client.NetworkManager.getInstance().profile.clientType== ClientType.ClientPresenter) && (
            //						WebMeeting.Client.NetworkManager.getInstance().profile.clientAccess.accessPrivateChat)) ||
            //						(WebMeeting.Client.NetworkManager.getInstance().profile.clientType== ClientType.ClientHost))
                    if(((WebMeeting.Client.NetworkManager.getInstance().profile.clientType== ClientType.ClientPresenter) || (WebMeeting.Client.NetworkManager.getInstance().profile.clientType== ClientType.ClientAttendee)) ||
                        (WebMeeting.Client.NetworkManager.getInstance().profile.clientType== ClientType.ClientHost))
                    {
                        //Trace.WriteLine("some user is selected");
                        priMsgRecIndex=getIndexofSelectedChatter(testCombo.SelectedItem.ToString());
                        Client.ClientUI.getInstance().listParticipents.Items[priMsgRecIndex].Selected = true;
                        //Trace.WriteLine("User Name " +  Client.ClientUI.getInstance().listParticipents.Items[(testCombo.SelectedIndex - 3)].Text.ToString());
                        //Client.ClientUI.getInstance().listParticipents.
                        //Trace.WriteLine("testcombo selected index" +Client.ClientUI.getInstance().listParticipents.Items[0].ToString() + " " + priMsgRecIndex.ToString());
                        //Client.ClientUI.getInstance().listParticipents.Items.i
                        this.txtBoxPreviewChat.Font=this.txtBoxPreviewChat.SelectionFont;
                        Client.ClientUI.getInstance().OpenChatWindow(true);
                        txtBoxPreviewChat.Clear();
                        txtBoxPreviewChat.Focus();
                    }

                }
            }

            catch(Exception exp)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("chatControl.cs ==>SendText( ==> 810",exp,exp.ToString()+" SendText",false);
            }
        }
예제 #4
0
        private void ProcessMessage(IMChatMessage receivedMessage)
        {
            try
            {
                //TODO: Change the default font of chat control.
                //this.txtBoxViewChat.TextColor=Khendys.Controls.RtfColor.Green;//Gray;

                //this.txtBoxViewChat.Font=titleFont;   made by junaid
                //this.txtBoxViewChat.Font
                //////////
                //if(Client.ClientUI.getInstance().chatTabControl.SelectedTab.Title != "Chat" )
                if(txtBoxViewChat==null)
                {
                    WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("private void ProcessMessage(IMChatMessage receivedMessage)txtBoxViewChat is null",new Exception(),null,false);
                }
                if( Client.ClientUI.getInstance().splitter1Closed )
                {
                    if(receivedMessage.sender == null)
                    {

                        //Trace.WriteLine("check is 2");
                        //System.Windows.Forms.MessageBox.Show(receivedMessage.IMMessage);
                        receivedMessage.IMMessage=receivedMessage.IMMessage.Substring(0,receivedMessage.IMMessage.Length-3);

                        //						if(receivedMessage.IMMessage.Substring(receivedMessage.IMMessage.Length-2,1)=="\n")
                        //						{
                        //							System.Windows.Forms.MessageBox.Show ("check 1 \n");
                        //						}
                        //						if(receivedMessage.IMMessage.Substring(receivedMessage.IMMessage.Length-2,1)=="\r")
                        //						{
                        //							System.Windows.Forms.MessageBox.Show("check 2 \r");
                        //						}
                        //txtBoxViewChat.AppendText(receivedMessage.sender + " :\n");
                        txtBoxViewChat.AppendRtf(receivedMessage.IMMessage); /// original sat:29.10

                    }
                    else
                    {

                        //WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Self made (Selfchat)exception before 1 else",new Exception(),null,false);

                        //Trace.WriteLine("check is 1");
                        txtBoxViewChat.AppendTextAsRtf(receivedMessage.sender + " :\n",myfont);
                        //txtBoxViewChat.AppendText(receivedMessage.sender + " :\n");
                        txtBoxViewChat.AppendRtf(receivedMessage.IMMessage); /// original sat:29.10
                        //WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Self made (Selfchat)exception after 1 else ",new Exception(),null,false);
                    }

                    //					if(receivedMessage.sender != null)
                    //						txtBoxViewChat.AppendText(receivedMessage.sender + " :\n");
                    //					txtBoxViewChat.AppendRtf(receivedMessage.IMMessage); /// original sat:29.10
                    if(!Client.ClientUI.getInstance().isChatAlreadyShown)
                    {
                        //fire delegate to show message alert
                        //in this way we are able to stop thread blockage
                        //if we show this form directly from this thread then it
                        //blocks the current running thread
                        Invoke(this.objDelShowAlert);
                        //Client.ClientUI.getInstance().showMessageAlert();
                    }

                }
                else
                {
                    ////////////////////
                    //	if(receivedMessage.sender.Length > 0)
                    if(receivedMessage.sender == null)
                    {
                        receivedMessage.IMMessage=receivedMessage.IMMessage.Substring(0,receivedMessage.IMMessage.Length-8);
                        ///System.Windows.Forms.MessageBox.Show(receivedMessage.IMMessage);
                        //						if(receivedMessage.IMMessage.Substring(receivedMessage.IMMessage.Length-3,1)=="\n")
                        //						{
                        //
                        //						}
                        //						if(receivedMessage.IMMessage.Substring(receivedMessage.IMMessage.Length-2,1)=="\r")
                        //						{
                        //
                        //						}
                        //txtBoxViewChat.AppendText(receivedMessage.sender + " :\n");
                        //Trace.WriteLine("check is 3");
                        if(txtBoxViewChat.Text.Trim().ToString()=="")
                            txtBoxViewChat.AppendRtf(receivedMessage.IMMessage); /// original sat:29.10
                    }
                    else
                    {

                        //System.Windows.Forms.MessageBox.Show(myfont.Bold.ToString());

                        ///		Trace.WriteLine("check is 4");
                        //txtBoxViewChat.AppendTextAsRtf(receivedMessage.sender  +" :");
                        //Trace.WriteLine("rtf text"  + txtBoxViewChat.Rtf.ToString() );
                        if(txtBoxViewChat.Text=="")
                            isCheckMessage=false;
                        else
                            isCheckMessage=true;
                        //txtBoxViewChat.AppendText(receivedMessage.sender + " :\n");
                        //		Trace.WriteLine("default value : " +txtBoxViewChat.Font.Bold.ToString() );
                        //		Trace.WriteLine("header information"  +txtBoxViewChat.Rtf.ToString());
                        //System.Windows.Forms.MessageBox.Show(txtBoxViewChat.Rtf.ToString());
                        //		Trace.WriteLine("1 rtf text"  + receivedMessage.IMMessage.ToString());
                        //System.Windows.Forms.MessageBox.Show(txtBoxViewChat.Rtf.ToString());

                        txtBoxViewChat.AppendTextAsRtf(receivedMessage.sender + " :\n",myfont);
                        //str = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Courier New;}}\viewkind4\uc1\pard\f0\fs20\\b0\par}";

                        ///		System.Windows.Forms.MessageBox.Show(txtBoxViewChat.Rtf.ToString());
                        //		System.Windows.Forms.MessageBox.Show(receivedMessage.IMMessage.ToString());
                        txtBoxViewChat.AppendRtf(receivedMessage.IMMessage); /// original sat:29.10
                        //txtBoxViewChat.AppendRtf(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Courier New;}}\viewkind4\uc1\pard\f0\fs20\b0}");
                        ///		Trace.WriteLine("rtf text"  + txtBoxViewChat.Rtf.ToString());
                        //		System.Windows.Forms.MessageBox.Show(txtBoxViewChat.Rtf.ToString());
                        //txtBoxViewChat.Ap

                    }
                }
                //else
                //	txtBoxViewChat.AppendText(receivedMessage.IMMessage); // appendRTF

                // Scroll to bottom so newly added text is seen.
                txtBoxViewChat.Select(txtBoxViewChat.TextLength,0) ;
                txtBoxViewChat.ScrollToCaret();

            }
            catch(Exception exp)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("chatControl.cs ==>cmenu_Emoticons_Click( ==> 346",exp,"Chat box error : "+exp.Message.ToString(),true);

            }
        }