private void Connect()
 {
     using (Synchronizer.Lock(this)) {
         if (this.m_Sender == null)
         {
             try {
                 this.m_Sender   = new RTPMessageSender(this.m_IPEndPoint, this.m_Model, this.m_Classroom);
                 m_NetworkStatus = new NetworkStatus(ConnectionStatus.Connected, ConnectionProtocolType.RTP, TCPRole.None, 0);
                 if (m_AdvertisedClassroom)
                 {
                     m_NetworkStatus.ClassroomName = "Advertised Classroom (" + m_IPEndPoint.Address.ToString() + ")";
                 }
                 else
                 {
                     m_NetworkStatus.ClassroomName = m_ClassroomName;
                 }
                 m_Model.Network.RegisterNetworkStatusProvider(this, true, m_NetworkStatus);
             } catch (System.Net.Sockets.SocketException se) {
                 //TODO: We need to display a real message box here...
                 MessageBox.Show("Connection failed\n\rMachine must be connected to a network.\r\n"
                                 + "If you repeatedly encounter this error, you may need to restart your machine.\r\n"
                                 + "This is a known bug.  Thanks for your patience.");
                 Debug.WriteLine("Connection failed: " + se.ToString());
             } catch (Exception e) {
                 //TODO: We need to display a real message box here...
                 MessageBox.Show("Connection failed: " + e.ToString());
             }
         }
     }
 }
Exemple #2
0
            public ParticipantManager(RTPMessageSender sender)
            {
                this.m_Sender = sender;

                this.m_Receivers    = new Hashtable();
                this.m_Participants = new Hashtable();

                RtpEvents.RtpStreamAdded   += new RtpEvents.RtpStreamAddedEventHandler(this.HandleStreamAdded);
                RtpEvents.RtpStreamRemoved += new RtpEvents.RtpStreamRemovedEventHandler(this.HandleStreamRemoved);
            }
Exemple #3
0
        public RTPMessageReceiver(RTPMessageSender sender, RtpStream stream, PresenterModel model, ClassroomModel classroom, ParticipantModel participant)
        {
            this.m_Model     = model;
            this.m_Sender    = sender;
            this.m_RtpStream = stream;

            this.m_Context     = new ReceiveContext(model, classroom, participant);
            this.m_ContextArgs = new object[] { this.m_Context };
            this.m_Queue       = new MessageProcessingQueue(this);

            this.m_Serializer = new BinaryFormatter();

            this.m_Assembler       = new ChunkAssembler();
            this.m_Assembler.Nack += new ChunkAssembler.NackDelegate(this.HandleAssemblerNack);

            this.m_RtpStream.FrameReceived += new RtpStream.FrameReceivedEventHandler(this.HandleFrameReceived);
        }
        public RTPMessageReceiver(RTPMessageSender sender, RtpStream stream, PresenterModel model, ClassroomModel classroom, ParticipantModel participant)
        {
            this.m_Model = model;
            this.m_Sender = sender;
            this.m_RtpStream = stream;

            this.m_Context = new ReceiveContext(model, classroom, participant);
            this.m_ContextArgs = new object[] { this.m_Context };
            this.m_Queue = new MessageProcessingQueue(this);

            this.m_Serializer = new BinaryFormatter();

            this.m_Assembler = new ChunkAssembler();
            this.m_Assembler.Nack += new ChunkAssembler.NackDelegate(this.HandleAssemblerNack);

            this.m_RtpStream.FrameReceived += new RtpStream.FrameReceivedEventHandler(this.HandleFrameReceived);
        }
        private void Disconnect()
        {
            RTPMessageSender sender = Interlocked.Exchange(ref this.m_Sender, null);

            if (sender != null)
            {
                m_Model.Network.RegisterNetworkStatusProvider(this, false, null);
                sender.Dispose();
            }

            // Clear out any presentations from the classroom
            using (Synchronizer.Lock(this.Classroom.SyncRoot)) {
                for (int i = this.Classroom.Presentations.Count - 1; i >= 0; i--)
                {
                    this.Classroom.Presentations.Remove(this.Classroom.Presentations[i]);
                }
            }
        }
 private void Connect()
 {
     using(Synchronizer.Lock(this)) {
         if(this.m_Sender == null) {
             try {
                 this.m_Sender = new RTPMessageSender(this.m_IPEndPoint, this.m_Model, this.m_Classroom);
                 m_NetworkStatus = new NetworkStatus(ConnectionStatus.Connected, ConnectionProtocolType.RTP, TCPRole.None, 0);
                 if (m_AdvertisedClassroom) {
                     m_NetworkStatus.ClassroomName = "Advertised Classroom (" + m_IPEndPoint.Address.ToString() + ")";
                 }
                 else {
                     m_NetworkStatus.ClassroomName = m_ClassroomName;
                 }
                 m_Model.Network.RegisterNetworkStatusProvider(this, true, m_NetworkStatus);
             } catch (System.Net.Sockets.SocketException se) {
                 //TODO: We need to display a real message box here...
                 MessageBox.Show("Connection failed\n\rMachine must be connected to a network.\r\n"
                     + "If you repeatedly encounter this error, you may need to restart your machine.\r\n"
                     + "This is a known bug.  Thanks for your patience.");
                 Debug.WriteLine("Connection failed: " + se.ToString());
             } catch (Exception e) {
                 //TODO: We need to display a real message box here...
                 MessageBox.Show("Connection failed: " + e.ToString());
             }
         }
     }
 }
            public ParticipantManager(RTPMessageSender sender)
            {
                this.m_Sender = sender;

                this.m_Receivers = new Hashtable();
                this.m_Participants = new Hashtable();

                RtpEvents.RtpStreamAdded += new RtpEvents.RtpStreamAddedEventHandler(this.HandleStreamAdded);
                RtpEvents.RtpStreamRemoved += new RtpEvents.RtpStreamRemovedEventHandler(this.HandleStreamRemoved);
            }