public void DisposeResources() { try { msgGlobalPencilMessage = null; if(CursorImage!=null) CursorImage.Dispose(); //tool=WhiteboardToolCode.Line;//.Brush;//.Ellipse;//Rectangle;//.Line; eventStore=null; msg=null; this.browserControl=null; if(undoArray!=null) { this.undoArray.Clear(); this.undoArray=null; } if(redoArray!=null) { redoArray.Clear(); redoArray=null; } //filename=""; if(textBox1!=null) { textBox1.Dispose(); textBox1=null; } } catch(Exception exp) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing public void Dispose Resources 488 line",exp,"",false); } }
public WhiteboardControl() { // This call is required by the Windows.Forms Form Designer. try { SelfFont=new FontStyle(); SelfFont=SelfFont|FontStyle.Bold; localCopyOfFont = new Font(this.Font.FontFamily,this.Font.Size,SelfFont); constFont=new FontStyle(); constFont=constFont|FontStyle.Bold; constmyFont = new Font(this.Font.FontFamily,this.Font.Size,constFont); InitializeComponent(); this.BackColor=Color.White; tool=WhiteboardToolCode.None;//.Brush;//.Ellipse;//Rectangle;//.Line; color=Color.Black; mouseDownPos=new Point(0,0); mouseCurrentPos=new Point(0,0); brushThickness=10; eventStore=new ArrayList(); pencilLastPoint=new Point(-1,-1); eraser=new Rectangle(0,0,10,10); msg=new WhiteboardMessage(); m_bDummyRect=new Rectangle(0,0,0,0); zoomLevel=1; ZoomView=false; undoArray=new ArrayList(); redoArray=new ArrayList(); filename=""; lineThickness=4; pA.nWidth = 10; pA.fTheta = 0.3f; pA.bFill = true; m_bIsActive = true; sendingThread = new Thread(new ThreadStart(SendingThreadFunction)); sendingThread.Name = "Whiteboard Control Constructor Thread: SendingThreadFunction()"; sendingThread.Start(); CursorImage = WebMeeting.Client.ClientUI.getInstance().LoadImageFromResource("WebMeeting.Client.cur.gif"); } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WhiteBoard public WhiteboardControl() ",ex,"",false); //Trace.WriteLine("public WhiteboardControl()"+" exception string :::: "+ex.ToString()+" stack trace ::: " +ex.StackTrace+" Message ::: " +ex.Message); } }
private void textBox1_Leave(object sender, System.EventArgs e) { try { string textboxvalue=this.textBox1.Text; WhiteboardMessage msg=new WhiteboardMessage(); Point p = GetCurrentScrollPositionBrowser(browserControl); msg.start=this.textBox1.Location;//mouseDownPos; msg.start.X += p.X; msg.start.Y += p.Y; msg.end=this.textBox1.Location; msg.end.X += p.X; msg.end.Y += p.Y; msg.tool=(ushort)WhiteboardToolCode.Text;//tool; msg.c=this.color; //msg.font=textBox1.Font; msg.font=this.localCopyOfFont; msg.thickness=this.lineThickness; msg.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; msg.text=textboxvalue; // msg.txtSize = textBox1.Font.Size; // msg.txtItalics = textBox1.Font.Italic; // msg.txtBold = textBox1.Font.Bold; // msg.txtUnderline = textBox1.Font.Underline; // msg.FontFamily = textBox1.Font.Name; // msg.txtSize = this.localCopyOfFont.Size; msg.txtItalics = this.localCopyOfFont.Italic; msg.txtBold = this.localCopyOfFont.Bold; msg.txtUnderline = this.localCopyOfFont.Underline; msg.FontFamily = this.localCopyOfFont.Name; msg.SlideNo=currentSlideNo; //Trace.WriteLine("no of Eventstore before msg writtign text" + this.eventStore.Count); msg.SenderID=NetworkManager.getInstance().profile.ClientId; this.eventStore.Add(msg); //Trace.WriteLine("no of Eventstore after msg writtign text" + this.eventStore.Count); //textboxvalue=this.textBox1.Text; this.textBox1.Visible=false; this.textBox1.Text=""; //msg.start.X -= p.X; //msg.start.Y -= p.Y; //msg.end=this.textBox1.Location; //msg.end.X -= p.X; //msg.end.Y -= p.Y; //this.CreateMouseMoveEx(msg); msg = new WhiteboardMessage(); msg.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; msg.start=this.textBox1.Location;//mouseDownPos; msg.start.X += p.X; msg.start.Y += p.Y; msg.end=this.textBox1.Location; msg.end.X += p.X; msg.end.Y += p.Y; msg.tool=(ushort)WhiteboardToolCode.Text;//tool; msg.c=this.color; msg.font=textBox1.Font; msg.thickness=this.lineThickness; msg.text=textboxvalue; msg.txtSize = textBox1.Font.Size; msg.txtItalics = textBox1.Font.Italic; msg.txtBold = textBox1.Font.Bold; msg.txtUnderline = textBox1.Font.Underline; msg.FontFamily = textBox1.Font.Name; msg.SlideNo=this.currentSlideNo; msg.SenderID = NetworkManager.getInstance().profile.ClientId; WebMeeting.Client.NetworkManager network = WebMeeting.Client.NetworkManager.getInstance(); AnnotMsg aMsg = new AnnotMsg(this.annotationType,this.thisSessionID,network.profile); aMsg.drawingMsg = msg; if(haveFrames) aMsg.sheetNo = currentSheet; else aMsg.sheetNo = -1; aMsg.SenderID = NetworkManager.getInstance().profile.ClientId; //network.SendLoadPacket(aMsg); sendingArray.Add(aMsg); //System.Diagnostics.Debug.Write("calling from textbox1_leave\n"); this.DrawNow=true; this.RepaintObjects(-1); } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing private void textBox1_Leave(object sender, System.EventArgs e)",ex,"",false); } }
public void ClearItems(bool bClearAll,int clientId) { ///////////////////////// try { WhiteboardMessage eraseMsg = new WhiteboardMessage(); msg.ConferenceID = WebMeeting.Client.NetworkManager.thisInstance.profile.ConferenceID; int noofItem=eventStore.Count; for(int i =(noofItem-1) ; i >=0; i--) { eraseMsg = (WhiteboardMessage)eventStore[i]; if(clientId==-1) { if(eraseMsg.SlideNo == currentSlideNo) { if(i>-1) { eventStore.RemoveAt(i); // only remove current messages //eventStore.Clear(); } } //eventStore.RemoveAt(i); // only remove current messages } if(eraseMsg.SenderID==clientId) { if(eraseMsg.SlideNo == currentSlideNo) { if(i>-1) { eventStore.RemoveAt(i); // only remove current messages //eventStore.Clear(); } } //eventStore.RemoveAt(i); // only remove current messages } ////////////////////////// } } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing public void ClearItems(bool bClearAll,int clientId)",ex,"",false); } //return; // check it //RepaintObjects(clientId);//done by junaid return; }
private void textBox1_Leave(object sender, System.EventArgs e) { try { WhiteboardMessage msg=new WhiteboardMessage(); msg.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; msg.start=this.textBox1.Location;//mouseDownPos; msg.end=this.textBox1.Location; msg.tool=(ushort)WhiteboardToolCode.Text;//tool; msg.c=this.color; msg.font=this.localCopyOfFont; msg.thickness=this.lineThickness; msg.text=this.textBox1.Text; this.eventStore.Add(msg); msg.txtSize = localCopyOfFont.Size; msg.txtItalics = localCopyOfFont.Italic; msg.txtBold = localCopyOfFont.Bold; msg.txtUnderline = localCopyOfFont.Underline; msg.FontFamily = localCopyOfFont.Name; NetworkManager network = NetworkManager.getInstance(); msg.SenderID = NetworkManager.getInstance().profile.ClientId;; msg.nSessionId = nSessionId; if(IsAppSharingWindow) msg.MessageType = (ushort) ((int)MessageObjectType.MsgAppSharingAnnotation); sendingArrayList.Add(msg); network.SendLoadPacket(msg); this.textBox1.Text=""; this.tool=WhiteboardToolCode.None; } catch(Exception ex) { ClientUI.getInstance().ShowExceptionMessage("Module ::: whiteboard private void textBox1_Leave(object sender, System.EventArgs e)",ex,"",false); //Trace.WriteLine("private void textBox1_Leave(object sender, System.EventArgs e)"+" exception string :::: "+ex.ToString()+" stack trace ::: " +ex.StackTrace+" Message ::: " +ex.Message); } }
public void sendFunction() { try { StateUpdateMessage msg; int preSendCount; WebMeeting.Client.NetworkManager network = WebMeeting.Client.NetworkManager.getInstance(); while(m_bIsActive) { try { if(sendingArray.Count <1) { Thread.Sleep(10); continue; } msg=new StateUpdateMessage(); if(WebMeeting.Common.AnnotationMessageType.WEB== annotationType) { msg.updateType= UpdateTypeCode.UpdateWebBrowser; } else { msg.updateType= UpdateTypeCode.UpdateWebDocument; } msg.dataArray = (ArrayList)sendingArray.Clone(); msg.SenderID = network.profile.ClientId; preSendCount=sendingArray.Count; network.SendLoadPacket(msg); if(preSendCount < sendingArray.Count) { // remove only seneded messages sendingArray.RemoveRange(0,preSendCount); } else { sendingArray.Clear(); } msg = null; // for(int i = 0 ; i < sendingArray.Count ; i++) // { // NetworkManager.getInstance().SendLoadPacket((MessageObject) sendingArray[i]); // } // sendingArray.Clear(); } catch(System.Threading.ThreadAbortException exp) { exp=exp; //WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing public void sendFunction()",ex,"",false); } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing public void sendFunction()",ex,"",false); } } } catch(System.Threading.ThreadAbortException exp) { exp=exp; //WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing public void sendFunction()",ex,"",false); } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing public void sendFunction()",ex,"",false); } }
// call if mouse button is pressed and move mouse void OnMouseMove(Point e) { try { color = NetworkManager.getInstance().profile.m_AssignedColor; if(((ushort)tool & (ushort)(WhiteboardToolCode.Brush | WhiteboardToolCode.Pencil | WhiteboardToolCode.Eraser )) == (ushort)tool) { // draw things by free hand section //msg=new WhiteboardMessage(); //msgPencilMessage = new WhiteboardMessage(); msgPencilMessage.start=mouseDownPos; //Trace.WriteLine("Mouse Down Position " + mouseDownPos.ToString()); Point p = GetCurrentScrollPositionBrowser(browserControl); if((ushort)tool==(ushort)WhiteboardToolCode.Eraser) { msgPencilMessage.end=new Point(e.X+p.X,e.Y+p.Y); } else msgPencilMessage.end=new Point(e.X+p.X,e.Y+p.Y); msgPencilMessage.tool=(ushort)tool; // there are no need of these things check it in mouseUp msgPencilMessage.c=this.color; /*if(((ushort)tool & (ushort)(WhiteboardToolCode.Brush)) == (ushort)tool) msgPencilMessage.thickness=this.brushThickness; else*/ if((ushort)tool==(ushort)WhiteboardToolCode.Pencil) msgPencilMessage.thickness=this.lineThickness; /*if(tool.ToString().ToLower()=="pencil") msgPencilMessage.thickness=this.lineThickness; else if(tool.ToString().ToLower()=="brush") msgPencilMessage.thickness=this.brushThickness;*/ msgPencilMessage.pencilLastPoint=new Point(this.pencilLastPoint.X,this.pencilLastPoint.Y); msgPencilMessage.SenderID = NetworkManager.getInstance().profile.ClientId; msgPencilMessage.text=WebMeeting.Client.NetworkManager.getInstance().profile.Name; if((ushort)tool==(ushort)WhiteboardToolCode.Pencil) { if(g!=null) { lock(g) { g.DrawLine((new Pen(msgPencilMessage.c,msgPencilMessage.thickness)),pencilLastPoint.X -p.X,pencilLastPoint.Y - p.Y, msgPencilMessage.end.X -p.X, msgPencilMessage.end.Y - p.Y); } } } else if((ushort)tool==(ushort)WhiteboardToolCode.Brush) { this.msgPencilMessage.thickness=this.brushThickness; Point ptlast=msgPencilMessage.pencilLastPoint; Point ptend=msgPencilMessage.end; ptend.X=ptend.X-p.X; ptend.Y=ptend.Y-p.Y; ptlast.X=ptlast.X-p.X; ptlast.Y=ptlast.Y-p.Y; DrawBrush1(ptlast,ptend,msgPencilMessage.c,this.brushThickness); // g.DrawLine((new Pen(msgPencilMessage.c,msgPencilMessage.thickness)),pencilLastPoint, msgPencilMessage.end); } else if((ushort)tool==(ushort)WhiteboardToolCode.Eraser) { //this.msgPencilMessage.end.X= this.msgPencilMessage.end.X-p.X; //this.msgPencilMessage.end.Y=this.msgPencilMessage.end.Y-p.Y; Point ptend=msgPencilMessage.end; ptend.X=ptend.X-p.X; ptend.Y=ptend.Y-p.Y; this.DrawEraser(ptend); } ////g.DrawLine((new Pen(msgPencilMessage.c,msgPencilMessage.thickness)),pencilLastPoint, msgPencilMessage.end); //DrawPencil(msgPencilMessage.pencilLastPoint,msgPencilMessage.end,msgPencilMessage.c, msgPencilMessage.thickness); //DrawBrush(e,msgPencilMessage.pencilLastPoint,msgPencilMessage.c); ////////////////////////////////// //++pointsDrawByPencil; msgPencilMessage.pencilLastPoints.Add(this.pencilLastPoint); msgPencilMessage.endPoints.Add(msgPencilMessage.end) ; msgPencilMessage.SlideNo = currentSlideNo; ///////////////////////////////////////////// // this.eventStore.Add(msgPencilMessage); // Trace.WriteLine("Event Store of current drawing" + this.eventStore.Count.ToString()); // // AnnotMsg amsg = new AnnotMsg(annotationType,thisSessionID ,NetworkManager.getInstance().profile); // amsg.drawingMsg = msgPencilMessage; // if(haveFrames) // amsg.sheetNo = currentSheet; // else // amsg.sheetNo = -1; // // amsg.SenderID = NetworkManager.getInstance().profile.ClientId; // // // sendingArray.Add(amsg); // by kamran pencilLastPoint.X = msgPencilMessage.end.X; // by kamran pencilLastPoint.Y = msgPencilMessage.end.Y ; // by kamran } else { // draw lines other than pencil Point p = GetCurrentScrollPositionBrowser(browserControl); WhiteboardMessage msg=new WhiteboardMessage(); msg.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; msg.start=mouseDownPos; msg.end=new Point(e.X + p.X ,e.Y + p.Y); //msg.end=new Point(e.X + p.X ,e.Y ); msg.tool=(ushort)tool; msg.c=this.color; msg.thickness=this.lineThickness; msg.SenderID = NetworkManager.getInstance().profile.ClientId; WhiteboardMessage m=new WhiteboardMessage(); m.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; m.c=msg.c; m.font=msg.font; m.tool=msg.tool; m.text= msg.text; m.txtSize = msg.txtSize; m.txtItalics = msg.txtItalics; m.txtBold = msg.txtBold; m.thickness = this.lineThickness; m.txtUnderline =msg.txtUnderline; m.FontFamily = textBox1.Font.Name; m.start=msg.start; m.pencilLastPoint=msg.pencilLastPoint; m.end=msg.end; m.SlideNo = currentSlideNo; m.start.Y -= p.Y; m.end.Y -= p.Y; m.start.X -= p.X; m.end.X -= p.X; // CreateMouseMove(m); } } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing void OnMouseMove(Point e)",ex,"",false); } }
private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { try { if(e.Button==MouseButtons.Left) { if(((ushort)tool & (ushort)(WhiteboardToolCode.Brush | WhiteboardToolCode.Pencil | WhiteboardToolCode.Eraser )) == (ushort)tool) { WhiteboardMessage msg=new WhiteboardMessage(); msg.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; msg.start=mouseDownPos; msg.end=new Point(e.X,e.Y); msg.pencilLastPoint=this.pencilLastPoint;//new Point(this.pencilLastPoint.X,this.pencilLastPoint.Y); msg.tool=(ushort)tool; msg.c=this.color; if(tool == WhiteboardToolCode.Brush) msg.thickness=this.brushThickness; else msg.thickness=this.lineThickness; msg.nSessionId = nSessionId; if(IsAppSharingWindow) msg.MessageType = (ushort) ((int)MessageObjectType.MsgAppSharingAnnotation); if((ushort)WhiteboardToolCode.Pencil==(ushort)tool) { pencilLastPoint=msg.end;//new Point(e.X,e.Y); lock(this) { g.DrawLine((new Pen(msg.c,msg.thickness)),msg.pencilLastPoint,msg.end); } while(this.pictureBox1.isPictureAssign==true) { } this.pictureBox1.Invalidate(); msg.SenderID = NetworkManager.getInstance().profile.ClientId; sendingArrayList.Add(msg); undoArray.Add(msg); } else if((ushort)WhiteboardToolCode.Brush==(ushort)tool) { pencilLastPoint=msg.end;//new Point(e.X,e.Y); DrawBrush(msg.pencilLastPoint, msg.end,msg.c,msg.thickness); while(this.pictureBox1.isPictureAssign==true) { } this.pictureBox1.Invalidate(); msg.SenderID = NetworkManager.getInstance().profile.ClientId; sendingArrayList.Add(msg); undoArray.Add(msg); } else { this.eventStore.Add(msg); pencilLastPoint=msg.end;//new Point(e.X,e.Y); //debug2.Add(new Point(pencilLastPoint.X,pencilLastPoint.Y)); msg.SenderID = NetworkManager.getInstance().profile.ClientId; sendingArrayList.Add(msg); } } } } catch(Exception ex) { ClientUI.getInstance().ShowExceptionMessage("Module ::: whiteboard private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)",ex,"",false); //Trace.WriteLine("private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)"+" exception string :::: "+ex.ToString()+" stack trace ::: " +ex.StackTrace+" Message ::: " +ex.Message); } }
public IEHwd() { try { msgGlobalPencilMessage = new WhiteboardMessage(); /*if(NetworkManager.getInstance().profile.clientType== ClientType.ClientAttendee) // for restricting attendees { Trace.WriteLine("attendee"); tool=WhiteboardToolCode.None; } else */ { //Trace.WriteLine("presenter"); tool=WhiteboardToolCode.Line;//.Brush;//.Ellipse;//Rectangle;//.Line; } CursorImage = WebMeeting.Client.ClientUI.getInstance().LoadImageFromResource("WebMeeting.Client.cur.gif"); //tool=WhiteboardToolCode.Line;//.Brush;//.Ellipse;//Rectangle;//.Line; color=Color.Red; mouseDownPos=new Point(0,0); mouseCurrentPos=new Point(0,0); brushThickness=10; eventStore=new ArrayList(); pencilLastPoint=new Point(-1,-1); eraser=new Rectangle(0,0,10,10); msg=new WhiteboardMessage(); m_bDummyRect=new Rectangle(0,0,0,0); undoArray=new ArrayList(); redoArray=new ArrayList(); //filename=""; lineThickness=4; pA.nWidth = 10; pA.fTheta = 0.3f; pA.bFill = true; recieveThread = new Thread(new ThreadStart(ConsumeThread)); sendingThread = new Thread(new ThreadStart(sendFunction)); sendingThread.Name="IE ControlHook Constructor: sendFunction()"; sendingThread.Start(); m_bIsActive =true; recieveThread.Name="IE ControlHook Constructor: ConsumeThread()"; recieveThread.Start(); textBox1 = new TextBox(); textBox1.Visible = false; //this.textBox1.Leave += new System.EventHandler(this.textBox1_Leave); this.textBox1.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyUp); this.textBox1.TextChanged += new EventHandler(textBox1_TextChanged); } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing public IEHwd()",ex,"",false); } }
void OnMouseDown(Point e) { try { msgPencilMessage = new WhiteboardMessage(); color = NetworkManager.getInstance().profile.m_AssignedColor; Point p = GetCurrentScrollPositionBrowser(browserControl); mouseDownPos=new Point(e.X+p.X,e.Y+p.Y ) ; //pencilLastPoint=new Point(e.X+p.X,e.Y+p.Y ); pencilLastPoint=new Point(e.X+p.X,e.Y + p.Y ); // by kamran fine if(this.textBox1.Visible==true) { this.textBox1.Visible=false; if (this.textBox1.Text!= "" ) textBox1_Leave(this,new System.EventArgs()); } if(this.tool==WhiteboardToolCode.Text) { // if(this.textBox1.Text!="") // { // textBox1_Leave(this,new System.EventArgs()); // } this.textBox1.Top=e.Y; this.textBox1.Left=e.X; this.textBox1.Visible=true; this.textBox1.Width=100; this.textBox1.BorderStyle=BorderStyle.None; browserControl.Controls.Add(textBox1); textBox1.BringToFront(); this.textBox1.Focus(); } } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing void OnMouseDown(Point e)",ex,"",false); } }
//Point mouseDownPos,Point currentPos,WhiteboardToolCode tool,Color c) private void CreateMouseMoveEx_JPG(WhiteboardMessage msg, ref Graphics g2) { try { p = GetCurrentScrollPositionBrowser(browserControl); pe = new Point(p.X , p.Y); scrollPoints = new Point(p.X , p.Y); //System.Diagnostics.Debug.Write("in create mouse move EX"); try { //Trace.WriteLine("current Slide No:" +this.currentSlideNo.ToString "Next Slide No :"); //if(currentSlideNo == msg.SlideNo) { switch((WhiteboardToolCode)msg.tool) { case WhiteboardToolCode.Ellipse: if(IsAttendee) { p.X = msg.start.X - p.X; p.Y = msg.start.Y - p.Y; pe.X = msg.end.X - pe.X; pe.Y = msg.end.Y - pe.Y ; //DrawEllipse(msg.start,msg.end,msg.c, msg.thickness); DrawEllipse_JPG(p,pe,msg.c, msg.thickness,ref g2); } else DrawEllipse_JPG(msg.start,msg.end,msg.c, msg.thickness,ref g2); break; case WhiteboardToolCode.Eraser: break; case WhiteboardToolCode.Line: DrawLine_JPG(msg.start,msg.end,msg.c, msg.thickness,ref g2); break; case WhiteboardToolCode.Brush: //if(IsAttendee) // isAttendee is true for(int i=0; i<msg.endPoints.Count ; i++ ) { p.X = ((Point)msg.pencilLastPoints[i]).X - scrollPoints.X; p.Y = ((Point)msg.pencilLastPoints[i]).Y - scrollPoints.Y; pe.X = ((Point)msg.endPoints[i]).X - scrollPoints.X; pe.Y = ((Point)msg.endPoints[i]).Y - scrollPoints.Y; this.DrawBrush1_JPG(p,pe,msg.c, this.brushThickness,ref g2); //msg.pencilLastPoint,msg.end,msg.c,msg.thickness //this.DrawBrush1(msg.pencilLastPoint,msg.end,msg.c, msg.thickness); this._mouseX=pe.X ; // by kamran check mouse move syncronyzation this._mousey=pe.Y ; DrawMouse(ref g2); } break; case WhiteboardToolCode.Pencil: { if(msg.endPoints.Count>0) { for(int i=0; i<msg.endPoints.Count ; i++ ) { p.X = ((Point)msg.pencilLastPoints[i]).X - scrollPoints.X; p.Y = ((Point)msg.pencilLastPoints[i]).Y - scrollPoints.Y; pe.X = ((Point)msg.endPoints[i]).X - scrollPoints.X; pe.Y = ((Point)msg.endPoints[i]).Y - scrollPoints.Y; DrawPencil_JPG(p,pe,msg.c, msg.thickness,ref g2); this._mouseX=pe.X ; // by kamran check mouse move syncronyzation this._mousey=pe.Y ; DrawMouse(ref g2); } } else { p.X = msg.pencilLastPoint.X - p.X; p.Y = msg.pencilLastPoint.Y - p.Y; DrawPencil_JPG(p,msg.end ,msg.c, msg.thickness,ref g2); } } break; case WhiteboardToolCode.Rectangle: DrawRectangle_JPG(msg.start,msg.end,msg.c, msg.thickness,ref g2); break; case WhiteboardToolCode.Text: if((msg.text!=null)&&(msg.txtSize!=0.0)&&(msg.text!="")) DrawText_JPG(msg.start,msg.text,msg.FontFamily,msg.txtSize,msg.txtBold,msg.txtItalics,msg.txtUnderline,msg.c,ref g2); break; case WhiteboardToolCode.UniArrow: if(IsAttendee) { p.X = msg.start.X - p.X; p.Y = msg.start.Y - p.Y; pe.X = msg.end.X - pe.X; pe.Y = msg.end.Y - pe.Y ; DrawUniArrow_JPG(p,pe,msg.c,msg.thickness,ref g2); //DrawUniArrow(msg.start,msg.end,msg.c,msg.thickness); } else DrawUniArrow_JPG(msg.start,msg.end,msg.c,msg.thickness,ref g2); break; case WhiteboardToolCode.PlaceHolderArrow: if(IsAttendee) { p.X = msg.start.X - p.X; p.Y = msg.start.Y - p.Y; PlaceHolderArrow_JPG(p,msg.c,msg.text,ref g2); } else PlaceHolderArrow_JPG(msg.start,msg.c,msg.text,ref g2); break; default: break; } } }//end of try catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing private void CreateMouseMoveEx(WhiteboardMessage msg)",ex,"",false); } } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing private void CreateMouseMoveEx(WhiteboardMessage msg)",ex,"",false); } }
private void CreateMouseMove(WhiteboardMessage msg) { //System.Diagnostics.Debug.Write("in create mouse move"); try { CreateMouseMoveEx(msg); } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing private void CreateMouseMove(WhiteboardMessage msg)",ex,"",false); } }
private void ConsumeThread() { try { int counter=0; bool modified=false; //Trace.WriteLine("Consume thread start now "); while(m_bIsActive==true) { //Trace.WriteLine("Consume thread start now "); while(messageStore.Count>0) { try { modified=true; if(((++counter)%10)==0) { modified=true; counter=0; } AnnotMsg aMsg =(AnnotMsg)messageStore[0]; message = aMsg.drawingMsg; WhiteboardMessage m=new WhiteboardMessage(); m.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; if((((WhiteboardToolCode)message.tool) != WhiteboardToolCode.Undo) && ( ((WhiteboardToolCode)message.tool) != WhiteboardToolCode.Redo)) { m.c=message.c; m.font=message.font; m.text=message.text; m.tool=message.tool; m.start=message.start; m.pencilLastPoint=message.pencilLastPoint; m.end=message.end; m.thickness=message.thickness; m.font=message.font; m.thickness=message.thickness; m.txtSize = message.txtSize; m.txtItalics = message.txtItalics; m.txtBold = message.txtBold; m.txtUnderline = message.txtUnderline; m.FontFamily = message.FontFamily; m.SenderID = aMsg.SenderID; m.pencilLastPoints = message.pencilLastPoints; // by kamran m.endPoints= message.endPoints; m.startPoints= message.startPoints; m.SlideNo= message.SlideNo; undoArray.Add(m); if((haveFrames) && (IsExcel)) { ((ArrayList)sheetsEventStores[aMsg.sheetNo]).Add(m); } else this.eventStore.Add(m); CreateMouseMoveEx(m); } messageStore.RemoveAt(0); } catch(System.Threading.ThreadAbortException exp) { exp=exp; } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing private void ConsumeThread()",ex,"",true); } } Thread.Sleep(10); // new old 1000 } } catch(System.Threading.ThreadAbortException ex) { ex=ex; } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing private void ConsumeThread()",ex,"",false); //Thread th=new Thread(new ThreadStart(ConsumeThread)); //th.Start(); } }
private void ConsumeThread() { try { int counter=0; while(m_bIsActive==true) { while(eventStore.Count>0) { try { // if(((++counter)%10)==0) // { // counter=0; // } message=(WhiteboardMessage)eventStore[0]; if((WhiteboardToolCode)message.tool==WhiteboardToolCode.Pencil) { lock(this) { g.DrawLine((new Pen(message.c,message.thickness)),message.pencilLastPoint,message.end); } if(message.SenderID != NetworkManager.getInstance().profile.ClientId) { this.undoArray.Add(message); } while(this.pictureBox1.isPictureAssign==true) { } this.pictureBox1.Invalidate(); if(eventStore.Count >0) eventStore.RemoveAt(0); // while(this.pictureBox1.isPictureAssign==true) // { // System.Threading.Thread.Sleep(10); // } // this.pictureBox1.Invalidate(); } else { WhiteboardMessage m=new WhiteboardMessage(); m.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; if((((WhiteboardToolCode)message.tool) != WhiteboardToolCode.Undo) && ( ((WhiteboardToolCode)message.tool) != WhiteboardToolCode.Redo)) { m.c=message.c; m.font=message.font; m.text=message.text; m.txtSize = message.txtSize; m.FontFamily = message.FontFamily; m.txtBold = message.txtBold; m.txtItalics = message.txtItalics; m.txtUnderline = message.txtUnderline; m.tool=message.tool; m.thickness = message.thickness; m.start=message.start; m.pencilLastPoint=message.pencilLastPoint; m.end=message.end; m.thickness=message.thickness; m.SenderID = message.SenderID; undoArray.Add(m); } if(eventStore.Count >0) eventStore.RemoveAt(0); //this.pictureBox1.Refresh(); //this.pictureBox1.Focus(); CreateMouseMove(message);//message.start,message.end,(WebMeetingDrawingBoard.WhiteboardToolCode) message.tool,message.c); while(this.pictureBox1.isPictureAssign==true) { System.Threading.Thread.Sleep(10); } this.pictureBox1.Invalidate(); //this.pictureBox1.Update(); CreateMouseMove(message);//message.start,message.end,(WebMeetingDrawingBoard.WhiteboardToolCode) message.tool,message.c); } } catch(System.Threading.ThreadAbortException ex) { ex=ex; } catch(Exception ex) { ClientUI.getInstance().ShowExceptionMessage("Module ::: private void ConsumeThread() ",ex,"",false); //Trace.WriteLine("private void ConsumeThread()"+" exception string :::: "+ex.ToString()+" stack trace ::: " +ex.StackTrace+" Message ::: " +ex.Message); } } Thread.Sleep(10); // only for loop } } catch(System.Threading.ThreadAbortException ex) { ex=ex; } catch(Exception ex) { ClientUI.getInstance().ShowExceptionMessage("Module ::: private void ConsumeThread() ",ex,"",false); } }
void OnMouseUp(Point e) { try { color = NetworkManager.getInstance().profile.m_AssignedColor; //pointsDrawByPencil = 0; //this.bScrollDraw=true; mouseCurrentPos.X=e.X; mouseCurrentPos.Y=e.Y; //if(((ushort)tool & (ushort)(WhiteboardToolCode.PlaceHolderArrow|WhiteboardToolCode.Brush | WhiteboardToolCode.Pencil | WhiteboardToolCode.Eraser | WhiteboardToolCode.Brush)) == (ushort)tool) if(((ushort)tool & (ushort)(WhiteboardToolCode.PlaceHolderArrow|WhiteboardToolCode.Brush | WhiteboardToolCode.Pencil | WhiteboardToolCode.Eraser )) == (ushort)tool) { //WhiteboardMessage msg=new WhiteboardMessage(); msgPencilMessage.start=mouseDownPos; Point p = GetCurrentScrollPositionBrowser(browserControl); msgPencilMessage.end=new Point(e.X + p.X ,e.Y + p.Y ); msgPencilMessage.tool=(ushort)tool; msgPencilMessage.thickness=this.lineThickness; msgPencilMessage.c=this.color; // if(tool.ToString().ToLower()=="pencil") // msgPencilMessage.thickness=this.lineThickness; // else if(tool.ToString().ToLower()=="brush") // msgPencilMessage.thickness=this.brushThickness; // msgPencilMessage.c=this.color; msgPencilMessage.pencilLastPoint=new Point(this.pencilLastPoint.X,this.pencilLastPoint.Y); msgPencilMessage.SenderID = NetworkManager.getInstance().profile.ClientId; msgPencilMessage.text=WebMeeting.Client.NetworkManager.getInstance().profile.Name; ////////////////////////////////// //++pointsDrawByPencil; msgPencilMessage.pencilLastPoints.Add(this.pencilLastPoint) ; msgPencilMessage.endPoints.Add(msgPencilMessage.end) ; msgPencilMessage.SlideNo = currentSlideNo; msgPencilMessage.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; ///////////////////////////////////////////// this.eventStore.Add(msgPencilMessage); AnnotMsg amsg = new AnnotMsg(annotationType,thisSessionID,NetworkManager.getInstance().profile); amsg.drawingMsg = msgPencilMessage; if(haveFrames) amsg.sheetNo = currentSheet; else amsg.sheetNo = -1; amsg.SenderID = NetworkManager.getInstance().profile.ClientId; sendingArray.Add(amsg); } else { if((ushort)tool!=(ushort)WhiteboardToolCode.Text) { //msg=new WhiteboardMessage(); Point p = GetCurrentScrollPositionBrowser(browserControl); msg = new WhiteboardMessage(); msg.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; msg.start=mouseDownPos; msg.end=new Point(e.X+p.X,e.Y + p.Y) ; msg.tool=(ushort)tool; msg.c=this.color; msg.thickness=this.lineThickness; msg.SenderID = NetworkManager.getInstance().profile.ClientId; msg.SlideNo = currentSlideNo; this.eventStore.Add(msg); AnnotMsg amsg = new AnnotMsg(annotationType,thisSessionID,NetworkManager.getInstance().profile); amsg.drawingMsg = msg; if(haveFrames) amsg.sheetNo = currentSheet; else amsg.sheetNo = -1; amsg.SenderID = NetworkManager.getInstance().profile.ClientId; sendingArray.Add(amsg);//NetworkManager.getInstance().SendLoadPacket(amsg); } } } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing void OnMouseUp(Point e)",ex,"",false); } }
//Point mouseDownPos,Point currentPos,WhiteboardToolCode tool,Color c) private void CreateMouseMove(WhiteboardMessage msg) { try { switch((WhiteboardToolCode)msg.tool) { case WhiteboardToolCode.Brush: DrawBrush(msg.pencilLastPoint,msg.end,msg.c,msg.thickness); break; case WhiteboardToolCode.Ellipse: DrawEllipse(msg.start,msg.end,msg.c, msg.thickness); break; case WhiteboardToolCode.Eraser: DrawEraser(msg.end); break; case WhiteboardToolCode.Line: DrawLine(msg.start,msg.end,msg.c, msg.thickness); break; case WhiteboardToolCode.Pencil: DrawPencil(msg.pencilLastPoint,msg.end,msg.c, msg.thickness); break; case WhiteboardToolCode.Rectangle: DrawRectangle(msg.start,msg.end,msg.c, msg.thickness); break; case WhiteboardToolCode.Text: lTxtMsg=msg; DrawText(msg.start,msg.text,msg.FontFamily,msg.txtSize,msg.txtBold,msg.txtItalics,msg.txtUnderline,msg.c); break; case WhiteboardToolCode.UniArrow: DrawUniArrow(msg.start,msg.end,msg.c,msg.thickness); break; case WhiteboardToolCode.Undo: Undo(); break; case WhiteboardToolCode.Redo: Redo();break; case WhiteboardToolCode.PlaceHolderArrow: PlaceHolderArrow(msg.start,msg.c,msg.text); break; default: break; } } catch(Exception ex) { ClientUI.getInstance().ShowExceptionMessage("Module ::: whiteboard private void CreateMouseMove(WhiteboardMessage msg)",ex,"",false); //Trace.WriteLine("private void CreateMouseMove(WhiteboardMessage msg)//Point mouseDownPos,Point currentPos,WhiteboardToolCode tool,Color c)"+" exception string :::: "+ex.ToString()+" stack trace ::: " +ex.StackTrace+" Message ::: " +ex.Message); } }
public void Add_Annotation_JPG(ref Graphics g2) { WhiteboardMessage m=new WhiteboardMessage(); if(eventStore.Count >0) { for(int i = 0 ; i <eventStore.Count ; i ++) { Point p = GetCurrentScrollPositionBrowser(browserControl); message=(WhiteboardMessage )eventStore[i]; m.c=message.c; m.font=message.font; m.tool=message.tool; m.text= message.text; m.txtSize = message.txtSize; m.txtItalics = message.txtItalics; m.txtBold = message.txtBold; m.txtUnderline =message.txtUnderline; m.FontFamily = textBox1.Font.Name; m.start=message.start; m.pencilLastPoint=message.pencilLastPoint; m.end=message.end; m.SlideNo = message.SlideNo; m.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; m.pencilLastPoints = message.pencilLastPoints; // by kamran m.endPoints= message.endPoints; m.startPoints= message.startPoints; if((ushort)message.tool==(ushort)WhiteboardToolCode.Brush) { this.CreateMouseMoveEx_JPG(m,ref g2); } else { if(this.IsAttendee) { m.thickness=message.thickness; CreateMouseMoveEx_JPG(m,ref g2); } else { m.start.Y -= p.Y; m.end.Y -= p.Y; m.start.X -= p.X; m.end.X -= p.X; m.thickness=message.thickness; CreateMouseMoveEx_JPG(m,ref g2); } } }//for loop }// If Statement }
private void pictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { try { mouseCurrentPos.X=e.X; mouseCurrentPos.Y=e.Y; if(e.Button==MouseButtons.Left) { if(msg ==null) msg=new WhiteboardMessage(); if((ushort)WhiteboardToolCode.Pencil==(ushort)tool) return; if(((ushort)tool & (ushort)(WhiteboardToolCode.Brush | WhiteboardToolCode.Pencil | WhiteboardToolCode.Eraser |WhiteboardToolCode.PlaceHolderArrow)) == (ushort)tool) { //WhiteboardMessage msg=new WhiteboardMessage(); msg.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; msg.start=new Point(mouseDownPos.X , mouseDownPos.Y); // new for checking why points are not new msg.end=new Point(e.X,e.Y); msg.tool=(ushort)tool; msg.c=this.color; msg.thickness=this.lineThickness; msg.pencilLastPoint=new Point(this.pencilLastPoint.X,this.pencilLastPoint.Y); msg.SenderID = NetworkManager.getInstance().profile.ClientId; msg.nSessionId = nSessionId; msg.text=NetworkManager.getInstance().profile.Name; if(IsAppSharingWindow) msg.MessageType = (ushort) ((int)MessageObjectType.MsgAppSharingAnnotation); this.eventStore.Add(msg); sendingArrayList.Add(msg); //System.Windows.Forms.PaintEventArgs e1=new System.Windows.Forms.PaintEventArgs(null,); //this.pictureBox1_Paint(sender,e1); this.pictureBox1.Refresh(); this.pictureBox1.Update(); } else { if((ushort)tool!=(ushort)WhiteboardToolCode.Text) { msg.start=new Point(mouseDownPos.X , mouseDownPos.Y); // check here for new points msg.end=new Point(e.X,e.Y); msg.tool=(ushort)tool; msg.c=this.color; msg.thickness=this.lineThickness; msg.nSessionId = nSessionId; if(IsAppSharingWindow) msg.MessageType = (ushort) ((int)MessageObjectType.MsgAppSharingAnnotation); this.eventStore.Add(msg); msg.SenderID = NetworkManager.getInstance().profile.ClientId; NetworkManager network = NetworkManager.getInstance(); sendingArrayList.Add(msg); } } msg = null; } } catch(Exception ex) { ClientUI.getInstance().ShowExceptionMessage("Module ::: whiteboard private void pictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)",ex,"",false); //Trace.WriteLine("private void pictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)"+" exception string :::: "+ex.ToString()+" stack trace ::: " +ex.StackTrace+" Message ::: " +ex.Message); } }
//******************************************************************************************// //******************************************************************************************// //******************************************************************************************// //******************************************************************************************// void RepaintObjects(int clientIdToSkip ) { try { Point bpt=new Point(0); bpt = GetCurrentScrollPositionBrowser(browserControl); //Trace.WriteLine(DrawNow.ToString()); if(NetworkManager.getInstance().profile.clientType != ClientType.ClientAttendee) this.IsAttendee=false; else this.IsAttendee =true; try { if(DrawNow) { //System.Diagnostics.Debug.Write("in repaint object"); DrawNow = false; Win32.USER32.RedrawWindow(browserHandle,IntPtr.Zero,IntPtr.Zero,Win32.USER32.RDW_INVALIDATE | Win32.USER32.RDW_UPDATENOW | Win32.USER32.RDW_ALLCHILDREN); DrawMouse(ref g); WhiteboardMessage m=new WhiteboardMessage(); previousStartPencilPoint=new Point(0); //Trace.AutoFlush=true; //Trace.WriteLine("no of values in eventstore : " + this.eventStore.Count.ToString() ); if(eventStore.Count >0) { for(int i = 0 ; i <eventStore.Count ; i ++) { Point p = GetCurrentScrollPositionBrowser(browserControl); message=(WhiteboardMessage )eventStore[i]; if(message.SenderID == clientIdToSkip) { eventStore.RemoveAt(i); i--; continue; } //Trace.WriteLine("Event Store = " + eventStore.Count); m.c=message.c; m.font=message.font; m.tool=message.tool; m.text= message.text; m.txtSize = message.txtSize; m.txtItalics = message.txtItalics; m.txtBold = message.txtBold; m.txtUnderline =message.txtUnderline; m.FontFamily = textBox1.Font.Name; m.start=message.start; m.pencilLastPoint=message.pencilLastPoint; m.end=message.end; m.SlideNo = message.SlideNo; m.ConferenceID = NetworkManager.thisInstance.profile.ConferenceID ; m.pencilLastPoints = message.pencilLastPoints; // by kamran m.endPoints= message.endPoints; m.startPoints= message.startPoints; if((ushort)message.tool==(ushort)WhiteboardToolCode.Eraser) { //Trace.WriteLine("End Points : " + msg.endPoints.ToString()); // Trace.WriteLine("End " + msg.end.ToString()); //Trace.WriteLine("Pencil Last Points" + msg.pencilLastPoint.ToString()); //Trace.WriteLine("Start " + msg.start.ToString()); //Trace.WriteLine("Start Poits" + msg.startPoints.ToString()); this.DrawEraser(msg.end); if(currentSlideNo == message.SlideNo) { //Trace.WriteLine("prev point : " + previousStartPencilPoint.ToString() + " ," + message.ToString()); //Trace.WriteLine("starting point of pencil" + message.startPoints.ToString() ); //Trace.WriteLine("how much loop runs " + message.endPoints.Count.ToString()); if( previousStartPencilPoint != message.start ) { //p = GetCurrentScrollPositionBrowser(browserControl); for(int k=0; k<message.endPoints.Count ; k++ ) { p=bpt; //m.pencilLastPoint = ((Point)message.pencilLastPoints[k ]); m.end = ((Point)message.endPoints[k ]); //m.start.Y -= p.Y; m.end.Y -= p.Y; //m.start.X -= p.X; m.end.X -= p.X; //m.thickness=message.thickness; this.DrawEraser(m.end); //p.X = m.pencilLastPoint.X - p.X; //p.Y = m.pencilLastPoint.Y - p.Y; //DrawPencil(p,m.end ,m.c, m.thickness); //CreateMouseMoveEx(m); //Trace.WriteLine("inner for loop" ); } p=bpt; } previousStartPencilPoint = message.start; } } else if((ushort)message.tool==(ushort)WhiteboardToolCode.Pencil) { if(currentSlideNo == message.SlideNo) { //Trace.WriteLine("prev point : " + previousStartPencilPoint.ToString() + " ," + message.ToString()); //Trace.WriteLine("starting point of pencil" + message.startPoints.ToString() ); //Trace.WriteLine("how much loop runs " + message.endPoints.Count.ToString()); if( previousStartPencilPoint != message.start ) { //p = GetCurrentScrollPositionBrowser(browserControl); for(int k=0; k<message.endPoints.Count ; k++ ) { p=bpt; m.pencilLastPoint = ((Point)message.pencilLastPoints[k ]); m.end = ((Point)message.endPoints[k ]); m.start.Y -= p.Y; m.end.Y -= p.Y; m.start.X -= p.X; m.end.X -= p.X; m.thickness=message.thickness; p.X = m.pencilLastPoint.X - p.X; p.Y = m.pencilLastPoint.Y - p.Y; DrawPencil(p,m.end ,m.c, m.thickness); //CreateMouseMoveEx(m); //Trace.WriteLine("inner for loop" ); } p=bpt; } previousStartPencilPoint = message.start; } } else if((ushort)message.tool==(ushort)WhiteboardToolCode.Brush) { this.CreateMouseMoveEx(m); } else { if(this.IsAttendee) { m.thickness=message.thickness; CreateMouseMoveEx(m); } else { m.start.Y -= p.Y; m.end.Y -= p.Y; m.start.X -= p.X; m.end.X -= p.X; m.thickness=message.thickness; CreateMouseMoveEx(m); } } ///if(IsAttendee) //{ // m.thickness=message.thickness; // CreateMouseMoveEx(m); //} } } DrawNow = false; } else { // SendMessage(browserControl.Handle,WM_ERASEBKGND, new IntPtr(),new IntPtr()); // SendMessage(browserControl.Handle,WM_PAINT, new IntPtr(),new IntPtr()); } } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing void RepaintObjects(int clientIdToSkip )",ex,"",false); //MeetingAlerts alert=new MeetingAlerts(); //alert.ShowMessage(WebMeeting.Client.Alerts.MeetingAlerts.AlertType.NonFatal,ee.Message,true,false); //MessageBox.Show(ee.Message); DrawNow = false; } } catch(Exception ex) { WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WebSharing void RepaintObjects(int clientIdToSkip )",ex,"",false); } }
public void SendingThreadFunction() { try { WebMeeting.Client.NetworkManager network = WebMeeting.Client.NetworkManager.getInstance(); StateUpdateMessage msg ; while(m_bIsActive) { if(sendingArrayList.Count <1) { Thread.Sleep(10); continue; } msg = new StateUpdateMessage(); if(this.IsAppSharingWindow) msg.updateType = UpdateTypeCode.UpdateAppsharingannotations; else msg.updateType = UpdateTypeCode.UpdateWhiteboard; msg.dataArray = (ArrayList)sendingArrayList.Clone(); msg.SenderID = network.profile.ClientId; preSendCount = sendingArrayList.Count; network.SendLoadPacket(msg); if(preSendCount < sendingArrayList.Count) { // remove only seneded messages sendingArrayList.RemoveRange(0, preSendCount ); } else { sendingArrayList.Clear(); } msg = null; } } catch(System.Threading.ThreadAbortException ex) { ex=ex; } catch(Exception ex) { ClientUI.getInstance().ShowExceptionMessage("Module ::: WhiteBoard public void SendingThreadFunction()",ex,"",false); //Trace.WriteLine("public void SendingThreadFunction()"+" exception string :::: "+ex.ToString()+" stack trace ::: " +ex.StackTrace+" Message ::: " +ex.Message); } }
/// <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)