public ConnectTCPRadioButton(ControlEventQueue dispatcher, PresenterModel model, ManualConnectionPanel manual, Point location, int width)
        {
            this.m_EventQueue = dispatcher;
            this.m_Model = model;
            this.m_Manual = manual;
            this.m_Connected = false;
            this.FlatStyle = FlatStyle.System;
            this.Font = Model.Viewer.ViewerStateModel.StringFont1;
            this.Text = Strings.ConnectToTCPServer;
            this.Location = location;
            this.Size = new Size(width, this.Font.Height + 5);
            this.m_ClassroomManager = null;

            //Watch for Role changes and disable if role is Instructor.
            this.m_RoleChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleRoleChanged));
            this.m_Model.Participant.Changed["Role"].Add(this.m_RoleChangedDispatcher.Dispatcher);
            using (Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) {
                if (this.m_Model.Participant.Role is InstructorModel)
                    this.Enabled = false;
                else
                    this.Enabled = true;
            }

            //should probably make this a listener
            //Do persistence in a more intelligent way - this doesn't make the popup pop up.
            /*using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot)) {
                if (this.Text == this.m_Model.ViewerState.ManualConnectionButtonName) {
                    this.Checked = true;
                    }
                }*/

            this.CheckedChanged += new EventHandler(OnClick);

            this.m_ProtocolCollectionHelper = new ProtocolCollectionHelper(this, this.m_Model.Network);
        }
Example #2
0
        public TCPConnectionManager(PresenterModel model)
        {
            this.m_Model    = model;
            this.m_Protocol = new ProtocolModel(this, "TCP");

            this.m_Classroom = new TCPClassroomManager(this.m_Model, this, Strings.InstructorStartTCPServer);

            using (Synchronizer.Lock(this.m_Protocol.SyncRoot)) {
                this.m_Protocol.Classrooms.Add(this.m_Classroom.Classroom);
            }
        }
        public TCPConnectionManager(PresenterModel model)
        {
            this.m_Model = model;
            this.m_Protocol = new ProtocolModel(this, "TCP");

            this.m_Classroom = new TCPClassroomManager(this.m_Model, this, Strings.InstructorStartTCPServer);

            using (Synchronizer.Lock(this.m_Protocol.SyncRoot)) {
                this.m_Protocol.Classrooms.Add(this.m_Classroom.Classroom);
            }
        }
        public BroadcastManager(PresenterModel model, TCPConnectionManager tcpMgr)
        {
            IPv6LinkLocalMulticast = IPAddress.Parse("ff02::1");
            UseIPv6 = false;
            //Use IPv6 only if IPv4 is unavailable

            if ((!Socket.OSSupportsIPv4) && (Socket.OSSupportsIPv6)) {
                UseIPv6 = true;
            }
            this.m_Model = model;
            this.m_TCPConnectionMgr = tcpMgr;
            this.m_TCPClassroomMgr = tcpMgr.ClassroomManager;
            this.m_TCPClientClassrooms = new Hashtable();
            this.m_RTPAdvertisedClassrooms = new Hashtable();
            m_EventQueue = new ThreadEventQueue();
               // this.m_RTPConnectionMgr = rtpMgr;

            StartListener();

            //Subscribe to the instructor advertisements that the BroadcastListener provides
            m_InstructorAdvertisementCollectionHelper = new InstructorAdvertisementCollectionHelper(this, this.m_Listener);

            //Subscribe to all the RTP Classrooms to learn when they connect/disconnect.
            //Notice that we assume there will be no new RTP classrooms created (other than the ones we create in response to advertisements).
            /*this.m_RtpClassroomConnected = false;
            using (Synchronizer.Lock(m_RTPConnectionMgr.Protocol.SyncRoot)) {
                foreach (ClassroomModel cm in m_RTPConnectionMgr.Protocol.Classrooms) {
                    cm.Changed["Connected"].Add(new PropertyEventHandler(OnRtpClassroomConnectedChanged));
                }
            }*/

            m_IsInstructor = false;
            using (Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) {
                //This is the server's identifier which remains constant for the app instance
                m_SenderID = this.m_Model.Participant.Guid;
                //Subscribe to the local presenter's role to track when we are instructor
                this.m_Model.Participant.Changed["Role"].Add(new PropertyEventHandler(OnRoleChanged));
                if (this.m_Model.Participant.Role is InstructorModel) {
                    m_IsInstructor = true;
                }
            }

            //Subscribe to the TCP Server to find out when it starts and stops
            this.m_TCPClassroomMgr.Changed["ServerStarted"].Add(new PropertyEventHandler(ServerStartedChangedHandler));
            m_TcpServerStarted = false;
            using (Synchronizer.Lock(m_TCPClassroomMgr.SyncRoot)) {
                if (m_TCPClassroomMgr.ServerStarted) {
                    m_TcpServerStarted = true;
                }
            }

            UpdateSenderStatus();
        }
 private void RemoveClassroom(TCPClassroomManager classroom)
 {
     this.m_Classrooms.Remove(classroom);
     this.Enabled = (this.m_Classrooms.Count > 0);
 }
 private void AddClassroom(TCPClassroomManager classroom)
 {
     this.m_Classrooms.Add(classroom);
     this.Enabled = true;
 }
 private void RemoveClassroom()
 {
     this.m_ClassroomManager = null;
     this.Enabled = false;
 }