Beispiel #1
0
        public void InitializeServer(NetworkManager networkMngr,bool DesktopSharing)
        {
            try
            {
                if(appServer != null)
                    appServer.Terminate();
            }
            catch(Exception ex)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: AppShare public void InitializeServer(NetworkManager networkMngr,bool DesktopSharing)",ex,"",false);
            }

            try
            {
                this.appShareClose+=new CloseAppShare(ApplicationSharing_appShareClose);
                bIsServer=true;
                appServer = new AppSharing(true);
                appServer.OnDataAvilable +=new OnDataAvilableDelegate(appServer_OnDataAvilable);
                appServer.OnDataAvilableEx+=new OnDataAvilableDelegateEx(appServer_OnDataAvilableEx);
                appServer.OnWindowClosed+=new OnWindowClosedDelegate(appServer_OnWindowClosed);
                network = networkMngr;
                isDesktopSharing = DesktopSharing;
                if(!DesktopSharing) //  !DesktopSharing is rigth
                {	 // application sharing
                    this.AutoRefresh.Enabled = true;
                    this.AutoRefresh.Interval = 10000;
                    this.AutoRefresh.SynchronizingObject = this;
                    CurrentProcessID=Process.GetCurrentProcess().MainWindowHandle.ToInt32();
                    SelectWindow();
                    this.AutoRefresh.Elapsed += new System.Timers.ElapsedEventHandler(this.AutoRefresh_Elapsed);
                    pictureBox1.Visible = false;

                    btnShare.Visible = false;
                    btnLog.Visible = true;

                    whiteBoard = new WebMeetingDrawingBoard.WhiteboardControl();
                    whiteBoard.OnScrolling +=new WebMeetingDrawingBoard.WhiteboardControl.ScrollingDelegate(whiteBoard_OnScrolling);
                    //appServer._whiteboard = whiteBoard;
                    whiteBoard.IsAppSharingWindow = true;
                    whiteBoard.Visible = false;
                    whiteBoard.btn_whtLogg.Visible=false;
                    //whiteBoard.InitializeToSize(400,400);
                    whiteBoard.Dock = DockStyle.Fill;
                    whiteBoard.BringToFront();
                    this.Controls.Add(whiteBoard);
                    whiteBoard.nSessionId = this.nSessionID;
                    btnShare.BringToFront();
                    btnLog.BringToFront();
                    btnLog.Visible=true;

                    //startMouseHook(); // try to mouse hook
                }
                else
                {
                    this.AutoRefresh.Enabled = false;
                    // Desktop sharing
                    btnShare.Visible = false;
                    btnLog.Visible = false;
                    appServer.bIsDesktopSharing = true;
                    //listView1.Visible = false;
                    pictureBox1.Visible = false;
                    appServer.SetCaptureWindowAndStartCapturing(Win32.USER32.GetDesktopWindow());
                    sendingThread = new Thread(new ThreadStart(SendingFunction));
                    sendingThread.Name = "Application Sharing Sending Thread";
                    sendingThread.Start();
                }
            }
            catch(Exception ex)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: AppShare public void InitializeServer(NetworkManager networkMngr,bool DesktopSharing)",ex,"",false);
            }
        }
Beispiel #2
0
        public void InitializeClient(NetworkManager networkMngr,bool DesktopSharing)
        {
            try
            {
                if(appServer!=null)
                {
                    appServer.Terminate();
                }
            }
            catch(Exception ex)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: AppShare public void InitializeClient(NetworkManager networkMngr,bool DesktopSharing) if(appServer!=null)	{appServer.Terminate();}",ex,"",false);
            }
            try
            {
                if(sendingThread!=null)
                {
                    if(sendingThread.IsAlive)
                    {
                        sendingThread.Abort();
                    }
                }
            }
            catch(Exception ex)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: AppShare public void InitializeClient(NetworkManager networkMngr,bool DesktopSharing) if(sendingThread.IsAlive){sendingThread.Abort();}",ex,"",false);
            }
            try
            {
                lblINfo.Visible = false;
                btnShare.Visible = false;
                bIsServer = false;
                appServer = new AppSharing(false);
                appServer.OnDataAvilable +=new OnDataAvilableDelegate(appServer_OnDataAvilable);
                appServer.OnDataAvilableEx +=new OnDataAvilableDelegateEx(appServer_OnDataAvilableEx);
                network = networkMngr;
                isDesktopSharing = DesktopSharing;
                //appServer.isWaitingPic = true;

                if(!DesktopSharing)
                {
                    whiteBoard = new WebMeetingDrawingBoard.WhiteboardControl();
                    whiteBoard.IsAppSharingWindow = true;
                    whiteBoard.InitializeToSize(400,400);
                    whiteBoard.Dock = DockStyle.Fill;
                    whiteBoard.BringToFront();
                    this.Controls.Add(whiteBoard);
                    pictureBox1.Visible = false;
                    whiteBoard.Visible = true;
                    whiteBoard.nSessionId = this.nSessionID;
                    _mouseThread = new Thread(new ThreadStart(this.MouseThreadFunction));
                    _mouseThread.Start();
                    _mouseThread.Name = "Application Sharing Mouse Movement Thread";

                }
                if(isDesktopSharing)
                {

                    appServer.bIsDesktopSharing = true;
                    //listView1.Visible = false;
                    //pictureBox1.Visible = true;
                    this.bSendActivity = true;
                    pictureBox1.OnKeyDownEvent += new DelegateKeyActivity(pictureBox1_OnKeyDownEvent);
                    pictureBox1.OnKeyUpEvent += new DelegateKeyActivity(pictureBox1_OnKeyUpEvent);
                    //pictureBox1.OnKeyPressEvent +=new DelegateKeyPress(pictureBox1_OnKeyPressEvent);
                    //if(networkMngr.profile.clientType == ClientType.ClientHost)  // attendee or presenter can not remote control to host(can not changes of host desktop)
                {
                    sendingThread = new Thread(new ThreadStart(SendingFunction));
                    sendingThread.Start();
                    sendingThread.Name = "Desktop Sharing Sending Thread";

                    //				  check for remote contorl
                    KeyboardSendingThread = new Thread(new ThreadStart(this.KeyboardThreadFunction));
                    KeyboardSendingThread.Start();
                    KeyboardSendingThread.Name = "Keyboard sending thread";

                }
                }
            }
            catch(Exception ex)
            {
                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Module ::: AppShare public void InitializeClient(NetworkManager networkMngr,bool DesktopSharing)",ex,"",false);
            }
        }