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);
        }
예제 #2
0
        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);
        }
 public ProtocolCollectionHelper(ManualConnectionPanel parent, NetworkModel network)
     : base(parent.m_EventQueue, network, "Protocols")
 {
     this.m_Parent = parent;
     base.Initialize();
 }
 public ClassroomCollectionHelper(ManualConnectionPanel parent, ProtocolModel protocol)
     : base(parent.m_EventQueue, protocol, "Classrooms")
 {
     this.m_Parent = parent;
     base.Initialize();
 }
            public ManualConnectionRadioButton(ControlEventQueue dispatcher, ClassroomModel classroom, ManualConnectionPanel parent, int i)
            {
                if (classroom == null)
                    throw new ArgumentNullException("classroom",
                        "The ClassroomModel associated with this ManualConnectionRadioButton cannot be null.");

                this.Font = Model.Viewer.ViewerStateModel.StringFont1;
                this.m_EventQueue = dispatcher;
                this.m_Classroom = classroom;
                this.Tag = classroom;
                this.Parent = parent;
                this.Parent.Controls.Add(this);
                this.index = i;
                int count = this.Parent.Controls.Count;
                #if RTP_BUILD
                this.Location = new Point(10,
                    (int)(((ManualConnectionPanel)(this.Parent)).MulticastLabel.Bottom +5
                        + 1.5*this.Font.Height * (this.index)));
                #endif

                this.Size = new Size(this.Parent.Width-15, this.Font.Height);

                string classroomName = "";
                using (Synchronizer.Lock(this.Classroom.SyncRoot)) {
                    classroomName = this.Classroom.HumanName;
                    }

                using (Synchronizer.Lock(((ManualConnectionPanel)(this.Parent)).m_Model.ViewerState.SyncRoot)) {
                    if (classroomName == ((ManualConnectionPanel)(this.Parent)).m_Model.ViewerState.ManualConnectionButtonName) {
                        this.Checked = true;
                        }
                    }

                if (classroomName == Strings.InstructorStartTCPServer) {

                    this.Location = new Point(10,
                        (int)(((ManualConnectionPanel)(this.Parent)).UnicastLabel.Bottom
                            + 4 * this.Font.Height * (this.index)));
                    this.Size = new Size(this.Parent.Width - 15, 3*this.Font.Height);
                        //this.Location = new Point(10, 200 + 30 * (this.index));
                        //this.Size = new Size(180, 30);
                        using (Synchronizer.Lock(((ManualConnectionPanel)(this.Parent)).m_Model.Participant.SyncRoot)) {
                            if (!(((ManualConnectionPanel)(this.Parent)).m_Model.Participant.Role is InstructorModel)) {
                                this.Visible = false;
                                this.Enabled = false;
                                }
                            }
                    }
                if (m_Classroom.ClassroomModelType == ClassroomModelType.Dynamic) {
                    //Note the locations of the radio buttons for the advertised (Dynamic) classrooms are set by the ManualConnectionPanel.UpdateLayout method

                    this.Size = new Size(this.Parent.Width - 20, 4 * this.Font.Height);

                    //This is a hack...  figure out why added more than once.
                    bool isAlreadyAdded = false;
                    int UDPControls = ((ManualConnectionPanel)this.Parent).m_Startup.m_UDPPanel.Controls.Count;
                    for (int j = 0; j < UDPControls; j++) {
                        if (((ManualConnectionPanel)this.Parent).m_Startup.m_UDPPanel.Controls[j].Text == classroomName) {
                            isAlreadyAdded = true;
                        }
                    }

                    if (!isAlreadyAdded) {
                        ((ManualConnectionPanel)this.Parent).m_Startup.m_UDPPanel.Controls.Add(new UDPPresentationRadioButton(this.m_Classroom, ((ManualConnectionPanel)this.Parent).m_Startup, UDPControls, this.m_EventQueue));
                        ((ManualConnectionPanel)this.Parent).m_Startup.m_UDPPanel.UpdateLayout();
                    }

                    using (Synchronizer.Lock(((ManualConnectionPanel)(this.Parent)).m_Model.Participant.SyncRoot)) {
                        if (((ManualConnectionPanel)(this.Parent)).m_Model.Participant.Role is InstructorModel) {
                            this.Visible = false;
                            }
                        }
                    }

                //If the role changes we should disconnect from our classroom
                this.m_ViewerStateRoleListener = new EventQueue.PropertyEventDispatcher(((ManualConnectionPanel)(this.Parent)).m_EventQueue,
                            new PropertyEventHandler(this.HandleViewerStateRoleChanged));
                ((ManualConnectionPanel)(this.Parent)).m_Model.ViewerState.Changed["iRole"].Add(this.m_ViewerStateRoleListener.Dispatcher);

                this.m_HumanNameChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleHumanNameChanged));

                this.Classroom.Changed["HumanName"].Add(this.m_HumanNameChangedDispatcher.Dispatcher);

                this.CheckedChanged += new EventHandler(HandleCheckedChanged);

                this.HandleHumanNameChanged(this.Classroom, null);
            }
예제 #6
0
            public ManualConnectionRadioButton(ControlEventQueue dispatcher, ClassroomModel classroom, ManualConnectionPanel parent, int i)
            {
                if (classroom == null)
                {
                    throw new ArgumentNullException("classroom",
                                                    "The ClassroomModel associated with this ManualConnectionRadioButton cannot be null.");
                }


                this.Font         = Model.Viewer.ViewerStateModel.StringFont1;
                this.m_EventQueue = dispatcher;
                this.m_Classroom  = classroom;
                this.Tag          = classroom;
                this.Parent       = parent;
                this.Parent.Controls.Add(this);
                this.index = i;
                int count = this.Parent.Controls.Count;

#if RTP_BUILD
                this.Location = new Point(10,
                                          (int)(((ManualConnectionPanel)(this.Parent)).MulticastLabel.Bottom + 5
                                                + 1.5 * this.Font.Height * (this.index)));
#endif

                this.Size = new Size(this.Parent.Width - 15, this.Font.Height);

                string classroomName = "";
                using (Synchronizer.Lock(this.Classroom.SyncRoot)) {
                    classroomName = this.Classroom.HumanName;
                }


                using (Synchronizer.Lock(((ManualConnectionPanel)(this.Parent)).m_Model.ViewerState.SyncRoot)) {
                    if (classroomName == ((ManualConnectionPanel)(this.Parent)).m_Model.ViewerState.ManualConnectionButtonName)
                    {
                        this.Checked = true;
                    }
                }

                if (classroomName == Strings.InstructorStartTCPServer)
                {
                    this.Location = new Point(10,
                                              (int)(((ManualConnectionPanel)(this.Parent)).UnicastLabel.Bottom
                                                    + 4 * this.Font.Height * (this.index)));
                    this.Size = new Size(this.Parent.Width - 15, 3 * this.Font.Height);
                    //this.Location = new Point(10, 200 + 30 * (this.index));
                    //this.Size = new Size(180, 30);
                    using (Synchronizer.Lock(((ManualConnectionPanel)(this.Parent)).m_Model.Participant.SyncRoot)) {
                        if (!(((ManualConnectionPanel)(this.Parent)).m_Model.Participant.Role is InstructorModel))
                        {
                            this.Visible = false;
                            this.Enabled = false;
                        }
                    }
                }
                if (m_Classroom.ClassroomModelType == ClassroomModelType.Dynamic)
                {
                    //Note the locations of the radio buttons for the advertised (Dynamic) classrooms are set by the ManualConnectionPanel.UpdateLayout method

                    this.Size = new Size(this.Parent.Width - 20, 4 * this.Font.Height);

                    //This is a hack...  figure out why added more than once.
                    bool isAlreadyAdded = false;
                    int  UDPControls    = ((ManualConnectionPanel)this.Parent).m_Startup.m_UDPPanel.Controls.Count;
                    for (int j = 0; j < UDPControls; j++)
                    {
                        if (((ManualConnectionPanel)this.Parent).m_Startup.m_UDPPanel.Controls[j].Text == classroomName)
                        {
                            isAlreadyAdded = true;
                        }
                    }

                    if (!isAlreadyAdded)
                    {
                        ((ManualConnectionPanel)this.Parent).m_Startup.m_UDPPanel.Controls.Add(new UDPPresentationRadioButton(this.m_Classroom, ((ManualConnectionPanel)this.Parent).m_Startup, UDPControls, this.m_EventQueue));
                        ((ManualConnectionPanel)this.Parent).m_Startup.m_UDPPanel.UpdateLayout();
                    }

                    using (Synchronizer.Lock(((ManualConnectionPanel)(this.Parent)).m_Model.Participant.SyncRoot)) {
                        if (((ManualConnectionPanel)(this.Parent)).m_Model.Participant.Role is InstructorModel)
                        {
                            this.Visible = false;
                        }
                    }
                }


                //If the role changes we should disconnect from our classroom
                this.m_ViewerStateRoleListener = new EventQueue.PropertyEventDispatcher(((ManualConnectionPanel)(this.Parent)).m_EventQueue,
                                                                                        new PropertyEventHandler(this.HandleViewerStateRoleChanged));
                ((ManualConnectionPanel)(this.Parent)).m_Model.ViewerState.Changed["iRole"].Add(this.m_ViewerStateRoleListener.Dispatcher);



                this.m_HumanNameChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleHumanNameChanged));

                this.Classroom.Changed["HumanName"].Add(this.m_HumanNameChangedDispatcher.Dispatcher);

                this.CheckedChanged += new EventHandler(HandleCheckedChanged);

                this.HandleHumanNameChanged(this.Classroom, null);
            }
예제 #7
0
 public ClassroomCollectionHelper(ManualConnectionPanel parent, ProtocolModel protocol)
     : base(parent.m_EventQueue, protocol, "Classrooms")
 {
     this.m_Parent = parent;
     base.Initialize();
 }
예제 #8
0
 public ProtocolCollectionHelper(ManualConnectionPanel parent, NetworkModel network)
     : base(parent.m_EventQueue, network, "Protocols")
 {
     this.m_Parent = parent;
     base.Initialize();
 }