Ejemplo n.º 1
0
 public void Save()
 {
     if(fileName=="")
     {
         SaveAs();
         return;
     }
     try
     {
         StreamWriter sw = new StreamWriter(this.fileName);
         sw.Write(this.textBox.Text);
         sw.Close();
         this.modified=false;
         MeetingAlerts alert=new MeetingAlerts();
         alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info,this.fileName + " saved",true,false);
     //				MessageBox.Show(this.fileName + " saved","WebMeeting",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Warning);
     }
     catch(Exception)
     {
         MeetingAlerts alert=new MeetingAlerts();
         alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Action,"Could not open " + this.fileName + " for writing",true,false);
         //MessageBox.Show("Could not open " + this.fileName + " for writing","WebMeeting",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 2
0
        public void downloadThreadFunction()
        {
            string strURL = fileInformation.filePath;
            string localpath = "webfile";
            int nIndex2 = strURL.LastIndexOf("/");
            if(nIndex2 != -1)
                localpath = strURL.Substring(nIndex2+1,strURL.Length - nIndex2-1);

            string localPath = _selectedFile;

            IsDownloadedSuccessfully = (DownloadFile(fileInformation.filePath,localpath) > 0);
            localFilePath = localpath;
            if(!IsDownloadedSuccessfully)
            {
                MeetingAlerts alert=new MeetingAlerts();
                alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info,"Unable to download file from server. Please contact Support",true,false);
                //MessageBox.Show("Unable to download file from server. Please contact Support","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
            else if(IsWebPresentation)
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }
Ejemplo n.º 3
0
        private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if( e.KeyChar == '\r' )
            {
                if(textBox1.Text.Trim()!="")
                {
                    if(testPollType == PollType.FreeResponse)
                    {
                        if(textBox1.Text.Length < 1)
                        {
                            MeetingAlerts alert=new MeetingAlerts();
                            alert.ShowMessage(Client.Alerts.MeetingAlerts.AlertType.Info,"Please enter your answer",true,false);
                            //MessageBox.Show("Please enter your answer","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
                            return;
                        }
                    }
                    //this.m_bAnswered=true;
                    btnAnswer.Enabled=false;
                    DialogResult=DialogResult.OK;
                    Close();

                }
            }
        }
Ejemplo n.º 4
0
        private void DocumentSharingThread()
        {
            //string strExt=".ppt";
            int no_of_RemoteFiles=8;
            string strPostRemoteUrl="";
            bool isRemoteUrlExist=false;
            string recordid="";
            MessageObject objMsg ;
            FileInfo theinfo;

            try
            {
                if(!this.IsLaunchFromMangeContent)
                {//in case false-----check manage content slideshow
                    //run when document is shared using menus.
                    //string Extension =strExt;//Path.GetExtension(DocumentFilePath);
                    string filename=Path.GetFileName(DocumentFilePath);
                    filenamed=Path.GetFileNameWithoutExtension(DocumentFilePath);
                    DocumentFilePath_temp=DocumentFilePath;
                    string Extension =Path.GetExtension(DocumentFilePath_temp);

                    theFile=new FileInfo(filename);

                    // 10 Mb Check
                    if((theFile.Length/1048576)>10)
                    {
                        MeetingAlerts alert=new MeetingAlerts();
                        alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info,"The size of this file is greater then 10Mb which may take time to Upload ",true,false);

                    }
                    //filenamed+=theFile.LastAccessTime.ToFileTime().ToString();

                    filenamed+=theFile.LastWriteTime.ToFileTime().ToString();
                    filenamed=filenamed.Replace('.','z');
                    filenamed=filenamed+Extension;
                    theFile.CopyTo(filenamed,true);
                    DocumentFilePath=Path.GetDirectoryName(DocumentFilePath)+@"\"+filenamed;
                    //DocumentFilePath=Path.GetFullPath(DocumentFilePath)+@"\"+filenamed;
                    Extension =Path.GetExtension(DocumentFilePath_temp);
                    //DocumentFilePath+=Extension
                    Extension = Extension.ToLower();

                    if(Extension == ".doc" ||Extension == ".docx")
                    {
                        documentType = DocumentMessageType.typeDocument;
                        strPostRemoteUrl="/"+Path.GetFileNameWithoutExtension(DocumentFilePath)+".htm";
                    }
                    else if(Extension == ".xls" ||Extension == ".xlsx")
                    {
                        documentType = DocumentMessageType.typeExcel;
                        if(no_of_RemoteFiles==1)
                            strPostRemoteUrl="/"+Path.GetFileNameWithoutExtension(DocumentFilePath)+".htm";
                        else
                            strPostRemoteUrl="/"+Path.GetFileNameWithoutExtension(DocumentFilePath)+"_files/sheet";
                    }
                    else if(Extension == ".ppt" || Extension == ".pptx")
                    {
                        documentType = DocumentMessageType.typePresentation;
                        // German PPT
                        //strPostRemoteUrl="/Folie";
                        strPostRemoteUrl="/slide";
                    }
                    else if(Extension == ".pdf")
                    {
                        documentType = DocumentMessageType.typePDF;
                        strPostRemoteUrl="/index.htm";
                    }

                    theinfo=new FileInfo(this.DocumentFilePath);
                    recordid=Client.ClientUI.getInstance().findRecord(Path.GetFileName(this.DocumentFilePath),theinfo.LastWriteTime.ToShortDateString().ToString());
                    if(recordid!="-1")
                        isRemoteUrlExist=true;
                    else
                    {
                        strLocalPath="";
                        isRemoteUrlExist=false;
                    }

                    //         Zaeem
                    if(isRemoteUrlExist==false)
                    {
                        DocumentSharingEx docEx = new WebMeeting.Client.DocumentSharingEx(
                            documentType,this.sessionID,Info.getInstance().FtpIP,Info.getInstance().UserName,
                            Info.getInstance().Password,Info.getInstance().ConferenceID);

                        docEx.OnStatusUpdateFunction = new WebMeeting.Client.DocumentSharingEx.OnStatusUpdate(OnStatusUpdate);
                        //MessageObject objMsg ;

                        //			docEx.DocumentShareStart(DocumentFilePath,out objMsg);

                        if(!docEx.DocumentShareStart(DocumentFilePath,out objMsg))
                        {
                            //Handle the failure;
                            MeetingAlerts alert=new MeetingAlerts();
                            alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info,"Unable to upload document to webserver",true,false);
                            return;
                        }
                        //						if(WebMeeting.Client.ClientUI.getInstance().InsertNewRecord(filename,((DocumentSharing)objMsg).DownloadURL,this.DocumentFilePath,((DocumentSharing)objMsg).TotalPages,((DocumentSharing)objMsg).DocumentType.ToString(),this.sessionID))
                        //							MessageBox.Show("Record Inserted");
                        //						else
                        //							MessageBox.Show("Record Not Inserted");
                        //
                        if(Extension == ".doc" ||Extension == ".docx")
                        {
                            documentType = DocumentMessageType.typeDocument;
                            strPostRemoteUrl="/"+Path.GetFileNameWithoutExtension(DocumentFilePath)+".htm";
                        }
                        else if(Extension == ".xls" || Extension == ".xlsx")
                        {
                            documentType = DocumentMessageType.typeExcel;

                            if(((DocumentSharing)objMsg).TotalPages==1)
                                //if()
                                strPostRemoteUrl="/"+Path.GetFileNameWithoutExtension(DocumentFilePath)+".htm";
                            else
                                strPostRemoteUrl="/"+Path.GetFileNameWithoutExtension(DocumentFilePath)+"_files/sheet";
                        }
                        else if(Extension == ".ppt" || Extension == ".pptx")
                        {
                            documentType = DocumentMessageType.typePresentation;
                            // German PPT
                            //strPostRemoteUrl="/Folie";
                            strPostRemoteUrl="/slide";
                        }
                        else if(Extension == ".pdf")
                        {
                            documentType = DocumentMessageType.typePDF;
                            strPostRemoteUrl="/index.htm";
                        }

                        IntializationCompleted = true;
                        //((DocumentSharing)objMsg).TotalPages=no_of_RemoteFiles;

                        ((DocumentSharing)objMsg).DownloadURL+=strPostRemoteUrl;
                        //MessageBox.Show("==>((DocumentSharing)objMsg).DownloadURL"+((DocumentSharing)objMsg).DownloadURL);
                        this.pictureCount = ((DocumentSharing)objMsg).TotalPages;
                        //theinfo=new FileInfo(this.DocumentFilePath);
                        Client.ClientUI.getInstance().InsertNewRecord(Path.GetFileName(DocumentFilePath),((DocumentSharing)objMsg).DownloadURL, Application.StartupPath +"\\" + this.sessionID.ToString()  ,((DocumentSharing)objMsg).TotalPages,((DocumentSharing)objMsg).DocumentType.ToString(),this.sessionID,theinfo.LastWriteTime.ToShortDateString().ToString());
                        theinfo=null;
                    }
                        ////////////               BY Zaeem                     ///////
                    else
                    {
                        DocumentSharing msg=new DocumentSharing();
                        objMsg=msg;
                        DataRow drShareMessage;
                        drShareMessage=Client.ClientUI.getInstance().getRecord(Convert.ToInt32(recordid));
                        string Extsion =Path.GetExtension(drShareMessage["FileName"].ToString());
                        this.strLocalPath=drShareMessage["LocalPath"].ToString();
                        if(Extsion == ".doc" ||Extsion == ".docx")
                        {
                            ((DocumentSharing)objMsg).DocumentType= DocumentMessageType.typeDocument;
                            //strPostRemoteUrl="/"+Path.GetFileNameWithoutExtension(DocumentFilePath)+".htm";
                        }
                        else if(Extsion == ".xls" || Extsion == ".xlsx")
                        {
                            ((DocumentSharing)objMsg).DocumentType= DocumentMessageType.typeExcel;
                            //							if(no_of_RemoteFiles==1)
                            //								strPostRemoteUrl="/"+Path.GetFileNameWithoutExtension(DocumentFilePath)+".htm";
                            //							else
                            //								strPostRemoteUrl="/"+Path.GetFileNameWithoutExtension(DocumentFilePath)+"_files/sheet";
                        }
                        else if(Extsion == ".ppt" || Extsion == ".pptx")
                        {
                            ((DocumentSharing)objMsg).DocumentType= DocumentMessageType.typePresentation;
                            //	strPostRemoteUrl="/slide";
                        }
                        else if(Extsion == ".pdf")
                        {
                            ((DocumentSharing)objMsg).DocumentType= DocumentMessageType.typePDF;
                            //	strPostRemoteUrl="/index.htm";
                        }
                        this.documentType=((DocumentSharing)objMsg).DocumentType;
                        //drShareMessage["LocalPath"]
                        ((DocumentSharing)objMsg).SenderID= NetworkManager.getInstance().profile.ClientId;
                        ((DocumentSharing)objMsg).ConferenceID=NetworkManager.getInstance().profile.ConferenceID;
                        ((DocumentSharing)objMsg).senderProfile=NetworkManager.getInstance().profile;
                        //((DocumentSharing)objMsg).ConferenceID=Info.getInstance().ConferenceID;
                        ((DocumentSharing)objMsg).sessionID=Convert.ToInt32(drShareMessage["Session"].ToString());
                        ((DocumentSharing)objMsg).DocumentSharingSessionId=Convert.ToInt32(drShareMessage["Session"].ToString());
                        ((DocumentSharing)objMsg).CurrentPage=1;
                        //						((DocumentSharing)objMsg).MessageType=
                        ((DocumentSharing)objMsg).nScrollX=0;
                        ((DocumentSharing)objMsg).nScrollY=0;
                        this.sessionID=	Convert.ToInt32(drShareMessage["Session"].ToString());
                        IntializationCompleted = true;
                        //drShareMessage["Session"]
                        ((DocumentSharing)objMsg).TotalPages=Convert.ToInt32(drShareMessage["TotalPages"]);
                        ((DocumentSharing)objMsg).DownloadURL=drShareMessage["RemoteURL"].ToString();

                        this.pictureCount = ((DocumentSharing)objMsg).TotalPages;
                        drShareMessage=null;
                    }

                    ProcessMessage(objMsg); //TODO:: optimized way is to add this mssg to poll and let thread do it
                    //but this causses file sharing error while same machine testing

                    //MessagePool.Add(objMsg);
                    NetworkManager.getInstance().SendMessage(objMsg);
                }//end if
                else
                {//start else
                    //runs when document sharing starts from manage content slideshow page

                    string Extension = this.strExtension;//Path.GetExtension(DocumentFilePath);
                    Extension = Extension.ToLower();

                    if(Extension == ".doc" || Extension == ".docx")
                        documentType = DocumentMessageType.typeDocument;
                    else if(Extension == ".xls" || Extension == ".xlsx")
                        documentType = DocumentMessageType.typeExcel;
                    else if(Extension == ".ppt" || Extension == ".pptx")
                        documentType = DocumentMessageType.typePresentation;
                    else if(Extension == ".pdf")
                        documentType = DocumentMessageType.typePDF;

                    //					DocumentSharingEx docEx = new WebMeeting.Client.DocumentSharingEx(
                    //						documentType,this.sessionID,Info.getInstance().FtpIP,Info.getInstance().UserName,
                    //						Info.getInstance().Password,Info.getInstance().ConferenceID);

                    //					docEx.OnStatusUpdateFunction = new WebMeeting.Client.DocumentSharingEx.OnStatusUpdate(OnStatusUpdate);
                    //					MessageObject objMsg ;

                    //			docEx.DocumentShareStart(DocumentFilePath,out objMsg);

                    NetworkManager networkMngr = NetworkManager.getInstance();
                    WebMeeting.Common.DocumentSharing message = new WebMeeting.Common.DocumentSharing();
                    message.SenderID = networkMngr.profile.ClientId;
                    message.senderProfile = networkMngr.profile;
                    message.sessionID = this.sessionID;
                    message.DocumentSharingSessionId = this.sessionID;
                    message.DownloadURL = "Already Downloaded," + this.strRemoteUrl;
                    message.DocumentType = documentType;
                    message.CurrentPage=1;
                    message.TotalPages=this.no_of_pages;

                    /*if(!docEx.DocumentShareStart(DocumentFilePath,out objMsg))
                    {
                        //Handle the failure;
                        MeetingAlerts alert=new MeetingAlerts();
                        alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info,"Unable to upload document to webserver",true,false);
                        return;
                    }*/

                    IntializationCompleted = true;
                    //this.pictureCount = ((DocumentSharing)objMsg).TotalPages; //  by junaid for now
                    this.m_DocumentDownloaded=true;
                    this.ProcessMessageManageContent(message); //TODO:: optimized way is to add this mssg to poll and let thread do it
                    //but this causses file sharing error while same machine testing
                    this.m_DocumentMessage=	message;
                    message.DownloadURL="Already Downloaded," + message.DownloadURL;
                    //MessagePool.Add(objMsg);
                    NetworkManager.getInstance().SendMessage(message);
                }//end else

            }
            catch (WebException err)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("documentSharingControl.cs ==> DocumentSharingThread() line==> 1773",err,null,false);
                //MeetingAlerts alert=new MeetingAlerts();
                //alert.ShowMessage(Alerts.MeetingAlerts.AlertType.NonFatal,this.Name + " Class : DocumentSharingThread() function ," + ex.Source + " Source ," + ex.Message ,true,false);
            }

            finally
            {
                try
                {
                    theFile=new FileInfo(filenamed);
                    theFile.Delete();
                }
                catch(Exception exp){}
            }
        }
Ejemplo n.º 5
0
        private void loginBtn_Click(object sender, System.EventArgs e)
        {
            /*if(txtBoxName.Text.Length < 1)
            {
                MessageBox.Show("Please enter a name","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return;
            }

            if(txtBoxEmail.Text.Length < 1)
            {
                MessageBox.Show("Please enter an email","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return;
            }
            if(txtFTPIP.Text.Length < 1)
            {
                MessageBox.Show("Please provide ftp address","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return;
            }
            if(txtConferenceID.Text.Length <  1)
            {
                MessageBox.Show("Please provide conference ID","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return;
            }*/
            if(txtPassword.Text.Length < 1)
            {
                MeetingAlerts alert=new MeetingAlerts();
                alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info,"Please provide passsword ",true,false);
                //MessageBox.Show("Please provide passsword ","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return;
            }
            Info.getInstance().Password=this.txtPassword.Text;
            //Info.getInstance().FtpIP=this.txtFTPIP.Text;

            this.DialogResult = DialogResult.OK;
            Close();
        }
Ejemplo n.º 6
0
        public bool CameraFound()
        {
            string strText = axShockwaveFlash2.GetVariable("cameraCount");
            int nCount = Convert.ToInt32(strText);
            if(nCount <0)
            {
                MeetingAlerts alert=new MeetingAlerts();
                alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info,"No Camera found",true,false);
                //MessageBox.Show("No Camera found","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }

            return (nCount >=0);
        }
Ejemplo n.º 7
0
        private void btnOpen_Click(object sender, System.EventArgs e)
        {
            DialogResult res;
            if(modified==true)
            {
                res=MessageBox.Show("Do you want to save the current notes","Save notes?",System.Windows.Forms.MessageBoxButtons.YesNoCancel);
                if(res==DialogResult.Cancel)
                    return;
                else if(res==DialogResult.Yes)
                {
                    btnSave_Click(this,new System.EventArgs());
                }
            }

            OpenFileDialog dlg=new OpenFileDialog();
            dlg.Filter="TXT|*.txt";
            res=dlg.ShowDialog();
            if(res==DialogResult.Cancel)
            {
                return;
            }
            try
            {
                fileName=dlg.FileName;//
                StreamReader sr = new StreamReader(dlg.FileName);
                string s = sr.ReadToEnd();
                sr.Close();
                ignoreFirst=true;
                this.textBox.Text=s;
                this.modified=false;
            }
            catch(Exception)
            {
                MeetingAlerts alert=new MeetingAlerts();
                alert.ShowMessage(Alerts.MeetingAlerts.AlertType.NonFatal,"Couldnt open " + this.fileName + " for reading",true,false);
                //MessageBox.Show("Couldnt open " + this.fileName + " for reading","WebMeeting",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 8
0
		/// <summary>
		/// Upload a file and set the resume flag.
		/// </summary>
		/// <param name="fileName"></param>
		/// <param name="resume"></param>
		public void Upload(string fileName, bool resume)
		{
			if ( !this.loggedin ) this.Login();

			Socket cSocket = null ;
			long offset = 0;

			if ( resume )
			{
				try
				{
					this.BinaryMode = true;

					offset = GetFileSize( Path.GetFileName(fileName) );
				}
				catch(Exception)
				{
					// file not exist
					offset = 0;
				}
			}

			FileStream input ;
			// open stream to read file
			try
			{
				int tries = 1;
				do
				{
					try
					{

						input = new FileStream(fileName,FileMode.Open,System.IO.FileAccess.Read,FileShare.Read);
						break;						
					}
					catch(Exception)// ee)
					{
						tries++;
						if(tries > 3)
							return;
						System.Threading.Thread.Sleep(200);
					}
				}while(true);
		
			

				if ( resume && input.Length < offset )
				{
					// different file size
					Debug.WriteLine("Overwriting " + fileName, "FtpClient");
					offset = 0;
				}
				else if ( resume && input.Length == offset )
				{
					// file done
					input.Close();
					Debug.WriteLine("Skipping completed " + fileName + " - turn resume off to not detect.", "FtpClient");
					return;
				}

				// dont create untill we know that we need it
				cSocket = this.createDataSocket();

				if ( offset > 0 )
				{
					this.sendCommand( "REST " + offset );
					if ( this.resultCode != 350 )
					{
						Debug.WriteLine("Resuming not supported", "FtpClient");
						offset = 0;
					}
				}

			
				this.sendCommand( "STOR " + Path.GetFileName(fileName) );

				if ( this.resultCode != 125 && this.resultCode != 150 ) throw new FtpException(result.Substring(4));

				if ( offset != 0 )
				{
					Debug.WriteLine("Resuming at offset " + offset, "FtpClient" );

					input.Seek(offset,SeekOrigin.Begin);
				}

				Debug.WriteLine( "Uploading file" + fileName + " to " + remotePath, "FtpClient" );

				long total=0;
				while ((bytes = input.Read(buffer,0,buffer.Length)) > 0)
				{
					cSocket.Send(buffer, bytes, 0);
					total+=bytes;
					progress=(int)((total*100)/input.Length);
					if(OnStatusUpdateFunction!= null)
					{
						
						OnStatusUpdateFunction(progress);
					}

					if(m_bBreak)
						break;
				}
			
				input.Close();

				if (cSocket.Connected)
				{
					cSocket.Close();
				}

				this.readResponse();

				if( this.resultCode != 226 && this.resultCode != 250 ) throw new FtpException(this.result.Substring(4));
			}
			catch(Exception ee)
			{
				MeetingAlerts alert=new MeetingAlerts();
				alert.ShowMessage(Client.Alerts.MeetingAlerts.AlertType.NonFatal,ee.Message + " Upload Function",true,false);			
				//System.Windows.Forms.MessageBox.Show(ee.Message + " Upload Function","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Error);

			}

		}
Ejemplo n.º 9
0
        public void Save()
        {
            try
            {

                if(this.filename=="")
                {
                    SaveAs();
                    return;
                }
                try
                {
                    this.mainImage.Save(filename,System.Drawing.Imaging.ImageFormat.Jpeg);
                }
                catch(Exception ex)
                {
                    MeetingAlerts alert=new MeetingAlerts();
                    alert.ShowMessage(WebMeeting.Client.Alerts.MeetingAlerts.AlertType.NonFatal,"Couldnt Save to " + filename,true,false);
                }
            }
            catch(Exception ex)
            {
                ClientUI.getInstance().ShowExceptionMessage("Module ::: whiteboard public void Save()",ex,"",false);
                //Trace.WriteLine("public void Save()"+" exception string :::: "+ex.ToString()+" stack trace ::: " +ex.StackTrace+" Message ::: "  +ex.Message);
            }
        }
Ejemplo n.º 10
0
 public void ShowExceptionMessage(string msg)
 {
     MeetingAlerts alert=new MeetingAlerts();
     alert.ShowMessage(Client.Alerts.MeetingAlerts.AlertType.NonFatal,msg,true,false);
     //MessageBox.Show(msg,"WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Information);
 }
Ejemplo n.º 11
0
        /// <summary>
        /// for receiving messages of different types 
        /// </summary>
		public void receiveThread()
		{
			
					
			MessageObject msg=null;			
			while(m_bIsActive)
			{

				try
				{		
			
					if(myRecvMsgList.Count==0)
					{
						Thread.Sleep(10);
						//Application.DoEvents(); // for check purpuse
						continue;
					}
					
					//try
					//{
					msg=(MessageObject)myRecvMsgList[0];
					//}
					//catch(Exception exp)
					//{
					//	WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 599 msg=(MessageObject)myRecvMsgList[0]; ",exp,null,false);
					//}						
						
					//try
					//{
					myRecvMsgList.RemoveAt(0);
					//}
					//catch(Exception exp)
					//{
					//	WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 526 receivethread myRecvMsgList.RemoveAt(0);",exp,null,false);	
					//}

					//for Syncronyzing tab positioning 

					if(myticker>10)
					{
						
						if(ClientUI.getInstance()!=null)
						ClientUI.getInstance().SynTabpositioning();
						myticker=0;
					}
					myticker++;




						#region Minuts of Meeting message
					// MessageClose.
					if(msg.GetType().Equals(typeof(Mes_MinutsofMeeting))) // per1
					{
						
						try
						{	
							// Only Host will take and UPload the SnapShot.
							if(profile.clientType==  ClientType.ClientHost)
							{
								
								MM_Controller._Snapshot(msg);
							}
						
						}
						catch(Exception exp)
						{
							WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 759 receivethread CloseMsg",exp,null,false);	
						}
						
					}
					#endregion

					    #region ClearAlltabs
					// This message close the tabs.
					if(msg.GetType().Equals(typeof(ClearAllTabs))) // per1
					{
						
						try
						{
							//c.BeginInvoke(this.ddel_CloseAllTabs);	
							//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before ClearAllTabs",null,null,false);	
							ClientUI.getInstance().ClientCloseAllTabs();
							
							//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread After ClearAllTabs",null,null,false);	

						}
						catch(Exception exp)
						{
							WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 532 receivethread ClearAllTabs",exp,null,false);	
						}
						
					}
					#endregion

						#region CloseMsg
					// MessageClose.
					if(msg.GetType().Equals(typeof(CloseMsg))) // per1
					{
						
						try
						{	
							if(pControl!=null)
							{
								pControl.attendeeForm.Close();
							}
							if(ClientUI.getInstance()!=null)
							{
								if(ClientUI.getInstance().frm_PollingGlobalAttendee!=null)
								{
									ClientUI.getInstance().frm_PollingGlobalAttendee.Close();
								}
														
							}
						}
						catch(Exception exp)
						{
							WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 741 receivethread CloseMsg",exp,null,false);	
						}
						
					}
					#endregion
			
						#region server info message
					//
					// This should be the first message from the server of type ServerInfoMessage.
					// Discard if this is not the case.
					//
					
					if(msg.GetType().Equals(typeof(ServerInfoMessage)))
					{
						
						//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before ServerInfoMessage",null,null,false);
						try
						{
						
							ServerInfoMessage infoMsgEx = (ServerInfoMessage) msg;														
							if(!bInitialMessage)
							{
								//pClient.listParticipents.Items.Clear();
								//pClient.arrayParticipents.Clear();
								try
								{
									Client.ClientUI.getInstance().ExceptionLog("sendTo object start pointing chatControl1.testCombo and following values are added <Main Chat>,<All Presenters> & <All Attendees> ::: method :: recived thread");
									pClient.sendTo.Items.Clear();
									int n = pClient.sendTo.Items.Add("<Main Chat>");
									pClient.sendTo.Items.Add("<All Presenters>");
									pClient.sendTo.Items.Add("<All Attendees>");
									pClient.sendTo.SelectedIndex = n;
								}
								catch(Exception exp)
								{
									WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 577 receivethread Serverinfo Messages;",exp,null,false);	
								}



							}	
						
							Thread.Sleep(3000);
						
							//pClient.listParticipents.Clear(); //.Items.re.Insert(0,name);								

							//////////////////// RECONNECT //////////////////////
							if(reconnectionnestablish)
							{
								try
								{
									while(! reConnEstablish_IsCleared)
									{
										Thread.Sleep(10); 
										Application.DoEvents();
									}
								}
								catch(Exception exp)
								{
									WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==>601 if(reconnectionnestablish);",exp,null,false);	
								}

							}
							///This code is added by zaeem on the 1st of December to solve the prob
							///of ==>on connection reestablishing menues gets disabled.
							///

							reConnEstablish_IsCleared = false;
							//////////////////////////////////////////

							int countFlag_LeaveFirstTime = 0;
							foreach (ClientProfile Cprofile in infoMsgEx.AttendeeProfileList.Values)
							{	
								try
								{
									string email=Cprofile.EMailAddress;
									string name= Cprofile.Name;
									string company= Cprofile.Company;
									ListViewItem v ;
									int local_id,remote_id;							
									remote_id=Cprofile.ClientId;
									local_id=profile.ClientId;
						    
									if(profile.ClientRegistrationId == Cprofile.ClientRegistrationId)
									{
										countFlag_LeaveFirstTime++;
									} 

									if(countFlag_LeaveFirstTime > 1) //Kamran
									{
										MeetingAlerts alert=new MeetingAlerts();
										alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info,"This User already entered in this Conference, You should use another User Registration ID.",true,false);
										alert.Dispose();
										Environment.Exit(0); // check for exit by sending closing message properly (call client_closing)
									}
							
									if(local_id==remote_id)
										continue;
									if(remote_id==0)
										continue;
							
									if(this.profile.Name==Cprofile.Name)
										continue;
									////////////////////////////
									bClientFlag = false;
									try
									{
										for(int i=0;i<pClient.arrayParticipents.Count  ;i++)
										{
											ClientProfile clientProf = (ClientProfile)pClient.arrayParticipents[i];
											if( clientProf.EMailAddress ==  Cprofile.EMailAddress )
											{
												bClientFlag = true;
												break;
											}
										}
									}
									catch(Exception ex)
									{
										WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==>656 Networkmanager receivethread;",ex,null,false);	
									}
									if(bClientFlag )
										continue;

									////////////////////////////

									if( Cprofile.clientType ==  ClientType.ClientHost )
									{
										v = pClient.listParticipents.Items.Insert(0,name);								
										pClient.listParticipents.Items[0].Font=new System.Drawing.Font("Arial",8,System.Drawing.FontStyle.Bold);
										if(profile.clientType!=ClientType.ClientAttendee)
										{
											v.SubItems.Add("");
											v.SubItems.Add("");									
											v.SubItems.Add("");
										}
									}
									else if( Cprofile.clientType ==  ClientType.ClientPresenter)
									{
										v = pClient.listParticipents.Items.Insert(pClient.listParticipents.Items.Count, name);
										v.SubItems[0].Font=new System.Drawing.Font("Arial",8,System.Drawing.FontStyle.Bold);
										if(profile.clientType!=ClientType.ClientAttendee)
										{
											v.SubItems.Add("");
											v.SubItems.Add("");	
											v.SubItems.Add("");
										}
									}
									else
									{								
										v = pClient.listParticipents.Items.Insert(pClient.listParticipents.Items.Count, name);
										if(profile.clientType!=ClientType.ClientAttendee)
										{
											v.SubItems.Add("");
											v.SubItems.Add("");									
											v.SubItems.Add("");
										}
									}							
									v.UseItemStyleForSubItems = false;
							
									v.SubItems.Add("").BackColor = Cprofile.m_AssignedColor;
									v.SubItems.Add("");

									SetMoodSubItemImage(v.Index,Cprofile);
									SetConnItemImage(v.Index,Cprofile);
									SetArrow(v.Index);

									int X = v.Index;							
									ClientProfile clientProfile = (ClientProfile)Cprofile;
									SetClientTypeImage(X,clientProfile);
									/////////////////////////////////////////
							
									pClient.arrayParticipents.Insert(v.Index,clientProfile);

							
									//////////////////////////////////////////
									ClientUI.getInstance().ExceptionLog("Adding Sendto Items " + clientProfile.Name.ToString());
									pClient.sendTo.Items.Add(clientProfile.Name);
									ClientUI.getInstance().ListParticipentCheckBoxChange(X,clientProfile.clientType);							
									/*
									if(ClientUI.getInstance().IfIamthePresenter())
									{
									ClientUI.getInstance().ena
									}
									*/

								}
								catch(Exception exp)
								{
									WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==>720 foreach Loop;",exp,null,false);	
								}

							}

							Client.ClientUI.getInstance().listParticipents.Items[0].Selected = true;
						}
						
						catch(Exception exp)
						{
							WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 700 receivethread Server Info msg",exp,null,false);	
						}
							
						//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread After ServerInfoMessage",null,null,false);
					}	

					
					else if(msg.GetType().Equals(typeof(AuthenticationMessage)))
					{
#if dbgNetworkLayer
						//Trace.WriteLine("Message Name :AuthenticationMessage , SenderId "+msg.SenderID + "Message Desc: " + msg.ToString()); 
#endif
						//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before AuthenticationMessage",null,null,false);	
						try
						{
							AuthenticationMessage Msg = (AuthenticationMessage)msg;
							if(!Msg.bAuthenticated)
							{
								ClientUI.getInstance().bAskPresenter = false;
								ClientUI.getInstance().Close();
								return;							
							}
							else
							{
								Info.getInstance().FtpIP = Msg.FTP_IP;
								Info.getInstance().Password = Msg.FTPPassoword;
								Info.getInstance().UserName = Msg.FTPUsername;
								Info.getInstance().VoiceConferenceID = Msg.voiceConferenceId;
								Info.getInstance().ConferenceName = Msg.ConferenceName;
							
								Info.getInstance().VoiceIP = Msg.VoiceIP;
								Info.getInstance().VoicePort = Convert.ToInt32(Msg.VoicePort);


								ClientUI.getInstance().ImageURL = Info.getInstance().WebsiteName + "/members/logos/" + Msg.ImageURL;
								profile.Name = Msg.ClientName;
								profile.EMailAddress = Msg.ClientEmail;

								ClientUI.getInstance().ConnectionEnabled();
								Info.getInstance().CompanyName = Msg.companyName ;			
								/////////////// meeting title to application title
								//ClientUI.getInstance().Text = Info.getInstance().CompanyName;
								ClientUI.getInstance().Text = Info.getInstance().ConferenceName;

							}
						}
						catch(Exception exp)
						{
							WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 739 receivethread Server Info msg",exp,null,false);	
						}
						//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread After AuthenticationMessage",null,null,false);	
					}
				
						#endregion
					
						#region Application Sharing 

					else if(msg.GetType().Equals(typeof(AppSharingMessageEx)))
					{	
						try
						{

						
							bool bContinue = false;
							appShareMsgQueue.Enqueue(msg);
							AppSharingMessageEx appMsg = (AppSharingMessageEx)msg;							
							if(appMsg.isDesktopshareing)
							{
 
								ClientUI.getInstance().DesktopSharingserver.RecieveMessageFromNetwork( ref appMsg);
							
								DataType d= (DataType)appMsg.nDataType;
								// delete the message only if it's mouse message.
								if( d == DataType.KeyBoardActivity)
									bContinue = true;
								myRecvMsgList.RemoveAt(0);
							}
							else
							{
								
								ClientUI.getInstance().RecieveAppSharingMessage(ref appMsg);
								if(!appMsg.bEnabled)
								{
									
									appShareMsgQueue.Clear();
								}
								appMsg = null; //KH
								GC.Collect(); //KH
								GC.WaitForPendingFinalizers(); //KH
							}
							if(bContinue)
								continue;
							
						}
						catch(Exception exp)
						{
							WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 825 receivethread==new application msg",exp,null,false);	
						}
						//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread After AppSharingMessageEx",null,null,false);	
					}
						#endregion
					
						#region PingTime
					else if(msg.GetType().Equals(typeof(ConnectionChechMessage)))
					{
#if dbgNetworkLayer
						//Trace.WriteLine("Message Name :ConnectionChechMessage , SenderId "+msg.SenderID + "Message Desc: " + msg.ToString()); 
#endif
						try
						{
							//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before ConnectionChechMessage",null,null,false);	
							ConnectionChechMessage connMsg = (ConnectionChechMessage)msg;
							connMsg.profile = profile;
							connMsg.profile.connectionCheckRecievedDateTime = DateTime.Now.ToFileTime();

							IConferenceRoom.RecieveConnectionMsgResponse(connMsg);
								
						}
						catch(Exception exp)
						{
							WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==>811 receivethread==>ping time",exp,null,false);	
						}
						//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread After ConnectionChechMessage",null,null,false);
				
					}
						#endregion
					
						#region conrol message
					else if(msg.GetType().Equals(typeof(ControlMessage)))
					{

						
						try
						{
							//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before ControlMessage",null,null,false);	
							ControlMessage controlMessage = (ControlMessage)msg;
							if(controlMessage.Code == ControlCode.AttendeeDropped)
							{
										
								try
								{
									ClientProfile clientProf = (ClientProfile)controlMessage.Parameter;								
									// this Methods only called from here 
									// When the presenter leaves the meeting 
									// All tabs are closed and drawing tools are Syncronyzed
									// flag_checkbox=false;
									// Assigning false to the above flag means 
									// that now there is no presenter in the meeting
									// and you are free to give any one the rights

									// CAUTION
									//	The line below may cause an Exceprion 
									// So first check if ClientUI.getInstance()!=null
									bool flg_presenterdrop=false;
									flg_presenterdrop=ClientUI.getInstance().NoofLogicalPresenters(clientProf);
									if(flg_presenterdrop)
									{
										// Poll windows should also be closed on this action
										try
										{	
											if(pControl!=null)
											{
												pControl.attendeeForm.Close();
											}
											if(ClientUI.getInstance()!=null)
											{
												ClientUI.getInstance().frm_PollingGlobalAttendee.Close();
														
											}
										}
										catch(Exception exp)
										{
											WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 1149 AfterWho is Dropped",exp,null,false);	
										}

									}


									// If the Attendee Drop message is for host
									if(clientProf.clientType == ClientType.ClientHost)
									{
										//This method should run when the Host is dropped from the meeting
										/// The purpose of this method is that the meeting shd come to the initial
										/// state i.e Presenter becomnes Attendee , Drawing tools are Syncronyzed 
										/// and all opened instances are closed.
										/// It should run only for Host
										/// 
										///					Zaeem View 
										// Improvment Area
										// 1 Message shd be send only to those who are Not Attendee currently
										// as i think its useless to send message to those who 
										// are already Attendee.
														
										bool flag=false;
										if(ClientUI.getInstance()!=null)
										{
											flag=ClientUI.getInstance().WhoisDropped(clientProf);
										}
										if(flag)
										{
																		
											// Poll windows should also be closed on this action
											try
											{	
												if(pControl!=null)
												{
													pControl.attendeeForm.Close();
												}
												if(ClientUI.getInstance()!=null)
												{
													ClientUI.getInstance().frm_PollingGlobalAttendee.Close();
														
												}
											}
											catch(Exception exp)
											{
												WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 1149 AfterWho is Dropped",exp,null,false);	
											}

										
										}
											
									}										
										
										
									ClientUI.getInstance().AttendeeDroped(clientProf);
										
									pClient.RemoveParticipent(clientProf);	
										
								}
								catch(Exception exp)
								{
									WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 852 receivethread==ControlCode.AttendeeDropped",exp,null,false);	
								}
							}
								/*
																	 else if (controlMessage.Code == ControlCode.AttendeeDropped)
																	 {
																		 ClientProfile clientProf = (ClientProfile)controlMessage.Parameter;
																		 Trace.WriteLine("ControlCode.AttendeeDropped"+ " ::: " + controlMessage.SenderID.ToString() + "  :::: " +  clientProf.ClientId.ToString());
							
																		 pClient.RemoveParticipent(clientProf);
																		 Client.ClientUI.getInstance()._statusBar.LeftMessage = "Connected    ";
																		 ClientUI.getInstance().AttendeeDroped(clientProf);
																	 }
											 */					

							else if(controlMessage.Code == ControlCode.PresenterKickedPerson)
							{
										
								try
								{
									//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before PresenterKickedPerson",null,null,false);
									ClientProfile clientProf = (ClientProfile)controlMessage.Parameter;
									if(clientProf.ClientId==this.profile.ClientId)
									{
										ClientUI.getInstance().ConferenceClosed();
										//MessageBox.Show("You have been kicked out of the conference by " + clientProf.Name ,"WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Information);								
										Environment.Exit(1);
										break;
									}
								} 
								catch(Exception exp)
								{
									WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 883 ControlCode.PresenterKickedPerson in receive thread msg",exp,null,false);	
								}
								//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread After PresenterKickedPerson",null,null,false);
							}							
							else if (controlMessage.Code == ControlCode.PresenterClosedConference)
							{
									
								try
								{
									//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before PresenterClosedConference",null,null,false);
									ClientProfile clientProf = (ClientProfile)controlMessage.Parameter;
									if(clientProf.ClientId == profile.ClientId)
									{
										ClientUI.getInstance().ConferenceClosed();
										MeetingAlerts alert=new MeetingAlerts();
										alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info,"Conference has been closed by " + clientProf.Name,true,false);
										alert.Dispose();
										Environment.Exit(0);
										//MessageBox.Show("Conference has been closed by " + clientProf.Name,"WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Information);								
										break;
									}
								} 
								catch(Exception exp)
								{
									WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 905 ControlCode.PresenterClosedConference in receive thread msg",exp,null,false);	
								}
								//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread After PresenterClosedConference",null,null,false);
								//Close();																
								//break;
							}
								#region AtttendeJoin
							else if(controlMessage.Code == ControlCode.AttendeeJoin)
							{			
								//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before AttendeeJoin",null,null,false);
								isNewAttendee = true;	// for new app sharing msgs
								ListViewItem v;
								int X = 0;
								ClientProfile clientProf = (ClientProfile)controlMessage.Parameter;
								bool bFound =false;
						
									
								# region RemoveODD---commented

								////								try
								////								{
								////									for(int i = 0 ; i < pClient.arrayParticipents.Count ; i++)
								////									{
								////										//	MessageBox.Show("listParticipents==>"+pClient.listParticipents.Items[i].Text.ToString());
								////
								////										ClientProfile CP = (ClientProfile)pClient.arrayParticipents[i];
								////										
								////										
								////										if(CP.Name == pClient.listParticipents.Items[i].Text.ToString())
								////										{
								////										
								////											WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Self made Line==> 1065 it was in list items",null,null,false);	
								////										
								////										
								////										}
								////										
								////										
								////										if(CP.Name == clientProf.Name)
								////										{	
								////											WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Self made  Line==> 1073 it was in arrayparticipents",null,null,false);	
								////									
								////											//	WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 905 ControlCode.PresenterClosedConference in receive thread msg",exp,null,false);	
								////											
								////											/*
								////												lock(pClient.arrayParticipents)
								////												{
								////													try
								////													{
								////														if(pClient.arrayParticipents.Count>i)
								////														{
								////															pClient.arrayParticipents.RemoveAt(i);
								////														}
								////													}
								////													catch(Exception exp)
								////													{
								////														WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("ClientUI.cs line==> if(arrayParticipents.Count>i)",exp,null,false);
								////													}
								////
								////												}
								////											
								////												lock(pClient.listParticipents)
								////												{
								////													try
								////													{
								////							
								////														if(pClient.listParticipents.Items.Count>i)
								////														{
								////															pClient.listParticipents.Items.RemoveAt(i);												
								////														}
								////													}
								////													catch(Exception exp)
								////													{
								////														WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("ClientUI.cs line==> if(listParticipents.Items.Count>i)",exp,null,false);
								////													}
								////												}
								////												*/
								////						
								////										}
								////									}
								////									
								////								}
								////								catch(Exception exp)
								////								{
								////									WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 1115 zaeem method of attendee join",exp,null,false);	
								////									
								//								}
								#endregion
									
									
									
								/*for(int i = 0 ; i < pClient.arrayParticipents.Count ; i++)
												 {
													 ClientProfile CP = (ClientProfile)pClient.arrayParticipents[i];
													 if(CP.ClientRegistrationId == clientProf.ClientRegistrationId)
													 {										
														 CP = clientProf;
														 bFound = true;
														 pClient.listParticipents.SetImage(i,0,0);										
														 v = pClient.listParticipents.Items[i];
														 v.SubItems[0].Text = CP.Name;
														 X = v.Index;
														 break;
													 }
												 }*/
							
								//							int local_id,remote_id;							
								//							remote_id=clientProf.ClientId;
								//							local_id=profile.ClientId;
								//							if(! reconnectionnestablish)
								bool isProfileExist =  false;
							
								if(reconnectionnestablish)
								{
									foreach(ClientProfile p in ClientUI.getInstance().arrayParticipents)
									{	
										if(clientProf.Name==p.Name)
										{
											isProfileExist = true;
											break;
										}
									}
								}
								
								
								  
						
								if(!isProfileExist )
								
									//							if( (local_id!=remote_id) && (local_id!=0) && (remote_id!=0) )

								{
									if(!bFound)
									{				
										//
										/*Thread.Sleep(3000); // for new app sharing msgs
													 isNewAttendee = true;	// for new app sharing msgs
													 */

										if(profile.clientType!=ClientType.ClientAttendee)								
										{									
											if((clientProf.clientType==ClientType.ClientAttendee)||(clientProf.clientType==ClientType.ClientPresenter))
												v =pClient.listParticipents.Items.Insert(pClient.listParticipents.Items.Count,clientProf.Name);
											else
												v =pClient.listParticipents.Items.Insert(0,clientProf.Name); 
									
											v.SubItems.Add("");
											v.SubItems.Add("");								
											v.SubItems.Add("");
										}
										else
										{			
											if(clientProf.clientType==ClientType.ClientAttendee)
												v =pClient.listParticipents.Items.Insert(pClient.listParticipents.Items.Count,clientProf.Name);
											else
												v =pClient.listParticipents.Items.Insert(0,clientProf.Name); 									
										}
										if(clientProf.clientType!=ClientType.ClientAttendee)									
											v.SubItems[0].Font= new System.Drawing.Font("Arial",8,System.Drawing.FontStyle.Bold);
										v.UseItemStyleForSubItems = false;								
										v.SubItems.Add("").BackColor = clientProf.m_AssignedColor;
										v.SubItems.Add("");															
										X = v.Index;									
										pClient.arrayParticipents.Insert(v.Index,clientProf);
										ClientUI.getInstance().ExceptionLog("Adding Sendto Items " + clientProf.Name.ToString() + " Message in ReceiveThread ::: ControlCode.AttendeeJoin");
										pClient.sendTo.Items.Add(clientProf.Name);								
										ClientUI.getInstance().listParticipents.SetImage(X,0,0);

										if(ClientUI.getInstance().myAppShareStarted)								
											ClientUI.getInstance()._appShareControl.AttendeeJoined();								

										////////////////////Sys_ChatMsgs//////////
										/*
										 * send all public message if the client type is host.
										 * */
										ClientUI.getInstance().chatControl1.Sys_SendText(clientProf.ClientId );

										//DocumentSharing msg = documentSharingControl.sys_DocSharing();
									
										for(int ii=0;ii<ClientUI.getInstance().arraydocumentSharing.Count ;ii++)
										{
											Crownwood.Magic.Controls.TabPage tabDocumentSharing	= (Crownwood.Magic.Controls.TabPage)ClientUI.getInstance().arraydocumentSharing[ii];
											documentSharingControl control = (documentSharingControl) tabDocumentSharing.Control;
											if(!control.IsClosed)
											{
												if(control.IsLaunchFromMangeContent)
												{
													string[] strLen=control.m_DocumentMessage.DownloadURL.Split(',');						
													//MessageBox.Show(strLen.Length.ToString());
						
													if(strLen.Length>1)
														NetworkManager.getInstance().SendLoadPacket(control.m_DocumentMessage);																									
													else			
													{
														//string previousUrl=control.m_DocumentMessage.DownloadURL;
														control.m_DocumentMessage.DownloadURL="Already Downloaded,"+control.m_DocumentMessage.DownloadURL;
													
														NetworkManager.getInstance().SendLoadPacket(control.m_DocumentMessage);
														//													control.m_DocumentMessage.DownloadURL=previousUrl;
													}
						
												
													//control.m_DocumentMessage.DownloadURL="Already Downloaded,"+control.m_DocumentMessage.DownloadURL;
												
												}
												else												
													NetworkManager.getInstance().SendLoadPacket(control.m_DocumentMessage);
											}				
										}
	

										///////////////////////////////////////////////
									}
									SetArrow(X);
									SetClientTypeImage(X,clientProf);
									SetConnItemImage(X,clientProf);
									SetMoodSubItemImage(X,clientProf);                     
									ClientUI.getInstance().ListParticipentCheckBoxChange(X,clientProf.clientType);
									Thread.Sleep(3000);
									
									//By zaeem to enable the menus on reconnection 
									if(ClientUI.getInstance()!=null)
									{
										if(ClientUI.getInstance().IfIamthePresenter())
										{
											
											ClientUI.getInstance().enableMenus(true);
										}
									}
										
										
									//ClientUI.getInstance().ShowWhiteBoard(false);
									if(this.profile.clientType == ClientType.ClientHost || this.profile.clientType == ClientType.ClientPresenter)
									{
										if(WebMeeting.Client.ClientUI.getInstance().isWhiteBoardSelected())
										{
										
											WhiteboardMessage t_msg = new WhiteboardMessage();
											t_msg.MessageType=(ushort)MessageObjectType.MsgShowWhiteBoard;
											t_msg.ConferenceID = this.profile.ConferenceID ;	
											SendLoadPacket(t_msg);			
											//Trace.WriteLine("new user come and packet of show WhiteBoard is selected"); 
										}
										else if(WebMeeting.Client.ClientUI.getInstance().isWhiteBoardEnabled())
										{
											//for problem of changing tab to WhiteBoard.
											WhiteboardMessage t_msg = new WhiteboardMessage();
											t_msg.ConferenceID = this.profile.ConferenceID ;	
											t_msg.MessageType=(ushort)MessageObjectType.MsgWhiteboard ;

											SendLoadPacket(t_msg);			
											//Trace.WriteLine("new user come and packet of WhiteBoard is Send"); 

										}
										try
										{
											//Trace.WriteLine("tabpages : " +ClientUI.getInstance().tabBody.TabPages.Count.ToString());
											for(int ii=0;ii<ClientUI.getInstance().tabBody.TabPages.Count;ii++)
											{
												Crownwood.Magic.Controls.TabPage tabpages = (Crownwood.Magic.Controls.TabPage)ClientUI.getInstance().tabBody.TabPages[ii];
												if(tabpages.Control.GetType().Equals(typeof(browser)))
												{
													//browser tabBrowser=new browser();
													//Trace.WriteLine("found browser window");
													browser tabBrowser=(browser) tabpages.Control;
													if(tabBrowser.isSharedBrowser== true)
														tabBrowser.ShareNewAttendee();
													//Zaeem's code 
													// whenever a new Attendee joins the meeting joins, its necessary to provide him with a new state 
													// this check checks whether the browser is in the image state 
													// if yes then the new guy shd provided with the latest image
													if(ClientUI.flag_ImageMode)
													{
														tabBrowser.CompressandSendImage(tabBrowser.whiteBoard._picBox.Image);
													}

												}
															
											}
										}
										catch(Exception exp)
										{
											WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 1580 Browser Update on Attendee Joining in receive thread msg",exp,null,false);	
										}

										ClientUI.getInstance().SynchronizeTabPages();//for the purpose of Synchronization of tabs when new attendee joins
									}
								

								
									// ApplicationSharing.maxApplication();

									////////////////////////
									//System.Timers.Timer aTimer = new System.Timers.Timer();
									//aTimer.Elapsed+=new System.Timers.ElapsedEventHandler(OnTimedEvent);
									// Set the Interval to 60 seconds.
									//aTimer.Interval=60000;
									//aTimer.Enabled=true;
									/////////////////////////////////
								
								

									/*Thread thLastMess = new Thread( new ThreadStart(ApplicationSharing.SendLastMSG_AppShare));
												 thLastMess.Name = ""; 
												 thLastMess.Start();
														 */
								}
								//else
								//	reconnectionnestablish = false;
								//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread After AttendeeJoin",null,null,false);
							}
								#endregion
							else if(controlMessage.Code == ControlCode.AttendeeLeave)
							{
								//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before AttendeeLeave",null,null,false);
								try
								{
									//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before AttendeeLeave",null,null,false);
									Trace.WriteLine("ControlCode.AttendeeLeave "+ " ::: " + controlMessage.SenderID.ToString());
									ClientProfile clientProf = (ClientProfile)controlMessage.Parameter;
									pClient.RemoveParticipent(clientProf);
									Client.ClientUI.getInstance()._statusBar.LeftMessage = "Connected    ";
									ClientUI.getInstance().AttendeeDroped(clientProf);
									//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread After AttendeeLeave",null,null,false);
								} 
								catch(Exception exp)
								{
									WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 1132 ControlCode.AttendeeLeave in receive thread msg",exp,null,false);	
								}
								//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread After AttendeeLeave",null,null,false);
							}
						
							else if(controlMessage.Code == ControlCode.AttendeeUpdate)
							{ 

								//WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("receivethread Before AttendeeUpdate",null,null,false);
								ClientProfile clientProf = (ClientProfile)controlMessage.Parameter;								
								bool OurProfileIsUpdate=false;
								//								try
								//								{
								//									//Trace.WriteLine(clientProf.Name.ToString()+"In receive thread has the==>"+clientProf.clientAccess.annotationRights.ToString());
								//								}
								//								catch(Exception exp){}
								// For making the the erease button enable and disable	

								// Written All by Zaeem
								// clientProf ---Coming with Message
								// profile ------profile of the this user
								// this try catch block deals with the erease All buuton 
								// Erease all can only be done by the Presenter 
								// So this button should only be visible to presenter 
								# region Erease All functionality
								//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

								try
								{
									
									if(ClientUI.getInstance()!=null)
									{
										if(clientProf.ClientId ==profile.ClientId && clientProf.clientType==ClientType.ClientPresenter)
										{
											ClientUI.getInstance().btnEraserVisible(true);
								
										}
										else if(clientProf.ClientId ==profile.ClientId && clientProf.clientType==ClientType.ClientHost)
										{
										
											if(ClientUI.getInstance().ifHostisPresenter())
											{
												ClientUI.getInstance().btnEraserVisible(true);
											}
											else
											{
												ClientUI.getInstance().btnEraserVisible(false);
											}
									
										}
										else if(clientProf.ClientId ==profile.ClientId && clientProf.clientType==ClientType.ClientAttendee)
										
										{
											ClientUI.getInstance().btnEraserVisible(false);
									
										}
									}
								}
								catch(Exception exp )
								{
									WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 1310",exp,null,false);	
								}
								//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
								# endregion

								//If the comming message is for me and i am not the current presenter
								#region updation of drawing Tools on the basis of ur profile.annotation rights
								//Removing Enable/Disable annoatation tools
								/*
								if(clientProf.ClientId ==profile.ClientId && clientProf.clientType!=ClientType.ClientPresenter)
								{
									try

									{
										if(ClientUI.getInstance()!=null)
										{
											if(clientProf.clientAccess.annotationRights)
											{
												ClientUI.getInstance().enableWhiteBoardTools(true);
											}
											else if(ClientUI.getInstance().IfIamthePresenter())
											{
												ClientUI.getInstance().enableWhiteBoardTools(true);
											}
											else
											{
												ClientUI.getInstance().enableWhiteBoardTools(false);
											}
										}
									}
									catch(Exception exp)
									{
										WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 1335",exp,null,false);	
														
									}
								
								
								}
								*/					
								# endregion

								//Zaeem View
								//Problem cause ==> this check is the real problematic one in the Attendee Update;
								// If the coming message is for Host and i am the current Host. 
								if(clientProf.clientType==ClientType.ClientHost && profile.clientType==ClientType.ClientHost)
								{	
									//MessageBox.Show("Host is deopped.So all the shared things are closing...");
									//ClientUI.getInstance().WhoisDropped(clientProf);
								}
								else
								{
									bool bFound = false;									
									for(int i = 0; i < ClientUI.getInstance().arrayParticipents.Count; i++)
									{								
										ClientProfile client = (ClientProfile)ClientUI.getInstance().arrayParticipents[i];
										if(clientProf.ClientId == client.ClientId)
										{									
											//Zaeem View
											// I think this pieve of code is not right.
											# region short fixing 
											// Only 1 time 
											//if its not our profile
											// Who so ever having the annotation rights
											// clientTemp is updated accordingly.
											if(clientProf.ClientId != profile.ClientId) 
											{
												for(int z = 0 ; z < ClientUI.getInstance().arrayParticipents.Count ; z++)
												{
													ClientProfile clientTemp = (ClientProfile)ClientUI.getInstance().arrayParticipents[z];
													if(clientTemp.ClientId==clientProf.ClientId)
													{															
														if(clientProf.clientAccess.annotationRights)
														{
															clientTemp.clientAccess.annotationRights=true;			
														}
														else
														{
															clientTemp.clientAccess.annotationRights=false;			
														}
														//ReInsertClientProfile(clientTemp,z);
														break;
													}
													////Trace.WriteLine("ReInsertClientProfile(clientTemp,z) is going to call");															
													
												}
											}
											# endregion

											
											/*this check will run when message is about our/current participant profile*/											
											if(clientProf.ClientId == profile.ClientId) // if this is the same user who shared the audio 
											{	
												# region D/V
												
												
												bool bChangeInterface = false;
												
												// clientProf---new comming profile
												if(profile.clientType == clientProf.clientType)
													bChangeInterface = false;
												else
													bChangeInterface = true;
												//////Trace.WriteLine("bChangeInterface : " + bChangeInterface.ToString()); 
												
												//Zaeem View
												// If our prifile is changing .......
												if(bChangeInterface)
												{
													/*to change splitter control visibility */
													//Zaeem View
													//Why this piece of code is here ?
													# region the current browser control's tool is assigned None
													for(int	ctrlbrowser =	0 ;	ctrlbrowser <	ClientUI.getInstance().arrayWebControl.Count;	ctrlbrowser++)
													{								
														Crownwood.Magic.Controls.TabPage tabPage = (Crownwood.Magic.Controls.TabPage)ClientUI.getInstance().arrayWebControl[ctrlbrowser];
														browser browserControl = (browser)tabPage.Control;																
														if(clientProf.clientType==ClientType.ClientAttendee)
														{
															browserControl.ShowSplitter(false);
															browserControl.annotationBrowser.selectToolNone();
														}
														else
														{
															browserControl.ShowSplitter(true);
															browserControl.annotationBrowser.SelectToolLine();
														}
														//												if(browserControl.sessionID ==	Msg.webBrowseID)
														//												{
														//													bFound = true;
														//													browserControl.msgPool.Add(Msg);																	
														//													break;
														//												}																						
													}
													# endregion 			


													# region Attendee Block								
													if(clientProf.clientType == ClientType.ClientAttendee)
													{
														try
														{

															//Zaeem View
															//if i am the attendee and has the annotation rights true 
															// then my tools shd be enabled but 
															// CAUTION
															// THIS WILL ONLY RUN WHEN MY PROFILE IS CHANGING.
															//profile1.clientAccess.accessSharePolling =
															# region 
															//Removing Enable/Disable annoatation tools
															/*
															if(profile.ClientId==clientProf.ClientId)
															{
																if(clientProf.clientAccess.annotationRights)
																{
																	ClientUI.getInstance().enableWhiteBoardTools(true);
																}
																else
																{
														
																	ClientUI.getInstance().enableWhiteBoardTools(false);
																}
															}
															*/	
															#endregion 
															////Trace.WriteLine("Condition true ClientUI.getInstance().ChangeParticipentsListControl(true )"); 
															///



															//Zaeem View
															// i dont know why it is here and what it does ?
															// this line may produce Exception as well.
															ClientUI.getInstance().ChangeParticipentsListControl(true);													
													
															
												
															//for(int index=0; index<=)
															//Zaeem View
															// Why this document sharing block is here ?
															# region document sharing block
															for(int	ListShareDocs =	0 ;	ListShareDocs <	ClientUI.getInstance().arraydocumentSharing.Count ;	ListShareDocs++)
															{															
									
																Crownwood.Magic.Controls.TabPage tabDocumentSharing	= (Crownwood.Magic.Controls.TabPage)ClientUI.getInstance().arraydocumentSharing[ListShareDocs];
																documentSharingControl control = (documentSharingControl) tabDocumentSharing.Control;
																control.m_bIsAllowedToAddAnnotations=false;
																control.chkThumbNail.Checked=false;
																control.chkThumbNail.Visible=true;
																control.chkShowThumbNails.Visible=true;
													
																control.chkThumbNail.Enabled=false;
																control.annotationBrowser.IsAttendee=true;
													
																//control.chkShowThumbNails.Enabled =false;
																//control.AttendeeFormDocument();
																														
															}
															# endregion

														}
														catch(Exception exp)
														{
															WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 1344",exp,null,false);	
														}
													}
														# endregion

														# region Presenter Block
														
													else if(clientProf.clientType == ClientType.ClientPresenter )
													{
														try
														{
															//Removing Enable/Disable annoatation tools
															// By Zaeem 
															// I am supposing that who ever is the presenter 
															// he should have the drawing rights;
															// that should be written once in the code 
															// ClientUI.getInstance() should check for not= Null;
															//ClientUI.getInstance().enableWhiteBoardTools(true);


															//Zaeem View 
															// these blocks shd not be in the Attendee Update Msg		
															// DOCSHARING BLOCK
															# region Why this doc sharing block is here ?
															for(int	ListShareDocs =	0 ;	ListShareDocs <	ClientUI.getInstance().arraydocumentSharing.Count ;	ListShareDocs++)
															{															
									
																Crownwood.Magic.Controls.TabPage tabDocumentSharing	= (Crownwood.Magic.Controls.TabPage)ClientUI.getInstance().arraydocumentSharing[ListShareDocs];
																documentSharingControl control = (documentSharingControl) tabDocumentSharing.Control;
																control.m_bIsAllowedToAddAnnotations=true;
																control.chkThumbNail.Checked=true;

																control.chkThumbNail.Visible=true;
																control.chkThumbNail.Enabled=true;
																control.chkShowThumbNails.Visible=true;
																//control.chkShowThumbNails.Enabled =true;
										
																control.annotationBrowser.IsAttendee=false;																					
																//control.HostFormPresentation();
															}
															# endregion
															////Trace.WriteLine("Condition true ClientUI.getInstance().ChangeParticipentsListControl(false)"); 
															///

															//Zaeem View 
															// Again what it does and why its here ?
															ClientUI.getInstance().ChangeParticipentsListControl(false);
														}
														catch(Exception exp)
														{
															WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 1379 receivethread ==>attendee update if (presenter);",exp,null,false);	
														}
														
													}
													# endregion


												}//end if(bChangeInterface)						
												
												/*
												 * Assign Current profile of network manager with new profile
												 * profile is network manager variable &  clientProf is new profile that came in message
												 * */
												profile = clientProf;
												////Trace.WriteLine("Update Main Menu Acccess Client.ClientUI.getInstance().UpdateMainMenuAccess();");
												///This wil Update the main Menu (Enable , disable according to rights)
												Client.ClientUI.getInstance().UpdateMainMenuAccess();
										
												//Zaeem View 
												// Very BAd piece of code 
												//this check already dealt above.
												if(bChangeInterface)
												{
													# region D/V 
													//checking our profile is update, in case of true OurProfileIsUpdate is true
													// Zaeem View ==> I think "IF" we are going to be the presenter in this check
													if(clientProf.clientType==ClientType.ClientPresenter && clientProf.ClientId==profile.ClientId)
													{
														OurProfileIsUpdate=true;				
													}
													try
													{
														bChangeInterface=false;

														
														// Zaeem View 
														// Why list is cleared here.
														// May be its updated again
														ClientUI.getInstance().listParticipents.Items.Clear();



														// Zaeem View 
														// Again , this check is does'nt look good to me.
														for(int z = 0 ; z < ClientUI.getInstance().arrayParticipents.Count ; z++)
														{
													
															// Previous clientProfile is Updates , so i think no use of the above check.
															ClientProfile clientTemp = (ClientProfile)ClientUI.getInstance().arrayParticipents[z];																											
															if(clientTemp.clientType==ClientType.ClientHost)
															{
																if(OurProfileIsUpdate==true)
																{
																	// Zaeem View
																	// Why they are made false here ?
																	// thats totally wrong i think
																	clientTemp.clientAccess.annotationRights=false;
																}
			
															}
															////Trace.WriteLine("ReInsertClientProfile(clientTemp,z) is going to call");															
															///
															// Now after clearing the list participent, They are all reinserted again
															// But this methdology needs to be checked
															// I think there shd be an optimised way for that
															// this method needs a detailed review
															ReInsertClientProfile(clientTemp,z);
														}
														Trace.WriteLine("No of participents in listparticipents & arrayparticipents :::: "  +ClientUI.getInstance().listParticipents.Items.Count.ToString() +  "  "+  ClientUI.getInstance().arrayParticipents.Count.ToString());
														bFound = true;
													}

													catch(Exception exp)
													{
														WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Line==> 1408 receivethread ==>attendee update if (presenter)==> if(bChangeInterface);",exp,null,false);	
													}
													# endregion 
												
												}//if(bChangeInterface)
													
												#endregion
											}//end of ==>  if(clientProf.ClientId == profile.ClientId) // if this is the same user who shared the audio 
											

											// This Method will run for those for which attendee Update is called 
											// and performs all the list related operations fot them
											// controlMessage.SenderID==>Sender ID from the Message.
											// i					  ==>index in the participant list
											//clientProf              ==>profile coming with the message
											//client                  ==>In loop  
											UpdateClientProfile(controlMessage.SenderID,i,ref client,ref clientProf);
											
											break;
										}//end if(clientProf.ClientId == client.ClientId)									
Ejemplo n.º 12
0
        public void InstallWindowsHook()
        {
            if(hHook == 0)
            {
                // Create an instance of HookProc.
                MouseHookProcedure = new Win32.USER32.HookProc(WindowHookProc);

                hHook = Win32.USER32.SetWindowsHookEx(Win32.USER32.WH_CALLWNDPROC,
                    MouseHookProcedure,
                    (IntPtr)0,
                    AppDomain.GetCurrentThreadId());
                //If SetWindowsHookEx fails.
                if(hHook == 0 )
                {
                    MeetingAlerts alert=new MeetingAlerts();
                    alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Warning,"SetWindowsHookEx Failed",true,false);
            //					MessageBox.Show("SetWindowsHookEx Failed");
                    return;
                }

            }
            else
            {
                bool ret = Win32.USER32.UnhookWindowsHookEx(hHook);
                //If UnhookWindowsHookEx fails.
                if(ret == false )
                {
                    MeetingAlerts alert=new MeetingAlerts();
                    alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Warning,"UnhookWindowsHookEx Failed",true,false);
                    //MessageBox.Show("UnhookWindowsHookEx Failed");
                    return;
                }
                hHook = 0;

            }
        }