Пример #1
0
        public void SendingThread()
        {
            try
            {
                //while(m_bIsActive==true)
                while(true)
                {

                    if(MsgPool_SendAnnotation.Count<1)
                    {
                        Thread.Sleep(10);
                        continue;
                    }

                        while(MsgPool_SendAnnotation.Count>0)
                        {

                            ///*
                            if(this.flag_SendingThread)
                            {

                                try
                                {
                                    //Monitor.Enter(ClientUI.Lock_MsgPool_SendAnnotation);
                                    //lock(ClientUI.Lock_MsgPool_SendAnnotation)
                                    lock(MsgPool_SendAnnotation.SyncRoot)
                                    {
                                        if(MsgPool_SendAnnotation.Count>0)
                                        {
                                            if(ClientUI.Flag_MsgPool_SendAnnotation)
                                            {
                                                MsgPool_SendAnnotation.RemoveAt(0);
                                            }
                                            else
                                            {
                                                message=(MsgAnnotation_Generic)MsgPool_SendAnnotation[0];
                                                NetworkManager.thisInstance.SendLoadPacket(message);
                                                if(MsgPool_SendAnnotation.Count>0)
                                                    MsgPool_SendAnnotation.RemoveAt(0);
                                            }
                                        }
                                    }

                                }
                                catch(Exception ex)
                                {
                                    WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WhiteBoard public void SendingThreadFunction()",ex,"",false);

                                }
                                finally
                                {
                                    //Monitor.Exit(ClientUI.Lock_MsgPool_SendAnnotation);

                                }
                            }
                            //*/
                            //ClientUI.browserControl.whiteBoard.MsgPool_Remove(0,1);
                        }//while

                    ClientUI.Flag_MsgPool_SendAnnotation=false;
                }
            }
            catch(System.Threading.ThreadAbortException ex)
            {
                ex=ex;
            }
            catch(Exception exp)
            {

                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: WhiteBoard public void SendingThreadFunction()",exp,"",false);

            }
        }
Пример #2
0
        public Whiteboard()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            SelfFont=new FontStyle();
            SelfFont=SelfFont|FontStyle.Bold;
            localCopyOfFont = new Font(this.Font.FontFamily,this.Font.Size,SelfFont);

            //Self BLock
            mouseCurrentPos=new Point(0,0);
            mouseFirstPos_OnDown=new Point(0,0);
            mouseLastPos_OnDown=new Point(0,0);
            mouseDownPos=new Point(0,0);

            pencilLastPoint=new Point(0,0);
            lastPoints=new Point(0,0);

            // Hard coded thickness
            brushThickness=8;
            eraser=new Rectangle(0,0,10,10);

            // For Arrow
            pA.nWidth = 10;
            pA.fTheta = 0.3f;
            pA.bFill = true;

            constFont=new FontStyle();
            constFont=constFont|FontStyle.Bold;
            constmyFont = new Font(this.Font.FontFamily,this.Font.Size,constFont);

            MsgPool_Annotation=new ArrayList();
            MsgPool_Annotation=(ArrayList)ArrayList.Synchronized(MsgPool_Annotation);

            MsgPool_SendAnnotation=new ArrayList();
            MsgPool_SendAnnotation=(ArrayList)ArrayList.Synchronized(MsgPool_SendAnnotation);

            MsgPool_Clear=new ArrayList();
            test=new ArrayList();
            msg=new MsgAnnotation_Generic();

            // TODO: Add any initialization after the InitializeComponent call
        }
Пример #3
0
        /// <summary>
        /// 
        /// This Method consume the Annotation Genric messgae designed for different modules
        /// </summary>
        public void ConsumeThread()
        {
            try
            {
                ArrayList temp_lst_Points;
                //while(m_bIsActive==true)
                while(true)
                {

                    if(MsgPool_Annotation.Count<1)
                    {
                        Thread.Sleep(10);
                        continue;
                    }

                    while(MsgPool_Annotation.Count>0)
                    {

                        try
                        {

                            message=(MsgAnnotation_Generic)MsgPool_Annotation[0];

                            // If this is true it means that a clear msg is generated
                            if(ClientUI.Flag_MsgPool_Annotation)
                            {

                                lock(MsgPool_Annotation.SyncRoot)
                                {
                                    if(MsgPool_Annotation.Count>0)
                                        MsgPool_Annotation.RemoveAt(0);
                                }
                            }
                            //If Pencil or brush is the tool
                            else if((enum_WhiteboardToolCode)message.tool==enum_WhiteboardToolCode.Brush || (enum_WhiteboardToolCode)message.tool==enum_WhiteboardToolCode.Pencil)
                            {

                                #region Brush or pencil
                                    //
                                    temp_lst_Points=(ArrayList)message.lst_Points.Clone();

                                this.MsgPool_Clear.Add(message);

                                if(message.lst_Points!=null)
                                {

                                    while (temp_lst_Points.Count>1)
                                    {

                                        //Thread.Sleep(100);
                                        try
                                        {

                                            lock(temp_lst_Points.SyncRoot)
                                            {
                                                message.pencilLastPoint=(Point)temp_lst_Points[0];
                                                message.end			   =(Point)temp_lst_Points[1];
                                            }
                                            CreateMouseMove(message);//message.start,message.end,(WebMeetingDrawingBoard.WhiteboardToolCode) message.tool,message.c);

                                            //message.lst_Points.RemoveRange(0,2);
                                            lock(message.lst_Points.SyncRoot)
                                            {
                                                temp_lst_Points.RemoveAt(0);
                                            }
                                        }
                                        catch(Exception exp)
                                        {
                                            WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Websharing 1165 new whiteboard.cs Consume Thread's While loop for annotation arraylistof points",exp,"",true);
                                        }

                                    }//while

                                }//If !=null

                                this._picBox.Invalidate();
                                this._picBox.Update();

                                try
                                {

                                    lock(MsgPool_Annotation.SyncRoot)
                                    {
                                        if(MsgPool_Annotation.Count>0)
                                            MsgPool_Annotation.RemoveAt(0);
                                    }
                                }

                                catch(Exception exp)
                                {
                                    WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: Websharing 1240 new whiteboard.cs  MsgPool_SendAnnotation removeaAt section in Consume Thread",exp,"",true);
                                }

                                #endregion

                            }

                            else
                            {

                                this.MsgPool_Clear.Add(message);

                                try
                                {

                                    lock(MsgPool_Annotation.SyncRoot)
                                    {
                                        if(MsgPool_Annotation.Count>0)
                                            MsgPool_Annotation.RemoveAt(0);
                                    }
                                }

                                catch(Exception exp)
                                {
                                    WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: Websharing 1240 new whiteboard.cs  MsgPool_SendAnnotation removeaAt section in Consume Thread",exp,"",true);
                                }

                                this._picBox.Invalidate();
                                CreateMouseMove(message);

                                this._picBox.Invalidate();
                                this._picBox.Update();
                                CreateMouseMove(message);//message.start,message.end,(WebMeetingDrawingBoard.WhiteboardToolCode) message.tool,message.c);

                            }
                        }
                        catch(System.Threading.ThreadAbortException ex)
                        {
                            ex=ex;
                        }
                        catch(Exception exp)
                        {
                            WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: private void ConsumeThread() ",exp,exp.Message,false);
                        }
                    }//while
                    ClientUI.Flag_MsgPool_Annotation=false;
                }
            }
            catch(Exception ex)
            {

            }
        }
Пример #4
0
        private void _picBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            msg=new MsgAnnotation_Generic();
            //mouseDownPos=new Point(e.X,e.Y);
            this.flag_SendingThread=false;
            try
            {

                color = NetworkManager.thisInstance.profile.m_AssignedColor;
                tool= (enum_WhiteboardToolCode)ClientUI.getInstance().whiteBoard.tool;

                mouseDownPos=new Point(e.X,e.Y);

                if(this.textBox1.Visible==true)//!="")
                {
                    textBox1_Leave(this,new System.EventArgs());
                    this.textBox1.Visible=false;
                }
                pencilLastPoint=new Point(e.X,e.Y);
                if(this.tool==enum_WhiteboardToolCode.Brush ||this.tool==enum_WhiteboardToolCode.Pencil)
                {

                    this.mouseFirstPos_OnDown=new Point(e.X,e.Y);
                    this.mouseLastPos_OnDown=this.mouseFirstPos_OnDown;
                    msg.lst_Points.Add(this.mouseLastPos_OnDown);

                    msg.ConferenceID = WebMeeting.Client.NetworkManager.thisInstance.profile.ConferenceID ;
                    msg.tool=(ushort)tool;
                    msg.c=this.color;

                    if(tool == enum_WhiteboardToolCode.Brush)
                        msg.thickness=this.brushThickness;
                    else
                        msg.thickness=WebMeeting.Client.ClientUI.getInstance().whiteBoard.LineThickness;

                }
                else if(this.tool!=enum_WhiteboardToolCode.None)
                {

                    if(this.tool==enum_WhiteboardToolCode.Text)
                    {
                        if(this.textBox1.Text!="")
                        {
                            textBox1_Leave(this,new System.EventArgs());
                        }
                        textBox1.Font=WebMeeting.Client.ClientUI.getInstance().whiteBoard.localCopyOfFont;

                        this.textBox1.Top=e.Y;
                        this.textBox1.Left=e.X;
                        this.textBox1.Visible=true;
                        this.textBox1.Width=100;
                        this.textBox1.BorderStyle=BorderStyle.None;
                        this.textBox1.Focus();
                    }

                }
            }
            catch(Exception ex)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: whiteboard private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)",ex,"",false);
                //Trace.WriteLine("private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)"+" exception string :::: "+ex.ToString()+" stack trace ::: " +ex.StackTrace+" Message ::: "  +ex.Message);
            }
        }