Exemplo n.º 1
0
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);
            this.clicked = true;

            if (this.m_Association != null)
            {
                // Set the role accordingly
                using (Synchronizer.Lock(this.m_Model.Participant)) {
                    if (this.m_Model.Participant.Role is InstructorModel || this.m_Model.Participant.Role == null)
                    {
                        this.m_Model.Participant.Role = new StudentModel(Guid.NewGuid());
                    }
                }

                // Set the network association
                using (Synchronizer.Lock(this.m_Model.Network.SyncRoot)) {
                    this.m_Model.Network.Association = this.Association;
                }
            }
            else
            {
                // Instead Start an Empty Presentation
                StartJoinButton2.StartEmptyPresentation(this.m_Model);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Configure the model for stand-alone instructor mode without displaying the startup form.
 /// </summary>
 public void StandaloneStartup()
 {
     using (Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) {
         if (!(this.m_Model.Participant.Role is InstructorModel))
         {
             this.m_Model.Participant.Role = new InstructorModel(Guid.NewGuid());
         }
     }
     using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot)) {
         this.m_Model.ViewerState.iRole = 0;
     }
     this.m_StartJoinButton.Association = null;
     StartJoinButton2.StartEmptyPresentation(this.m_Model);
 }
Exemplo n.º 3
0
 void StartupForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!(this.m_StartJoinButton.clicked))
     {
         using (Synchronizer.Lock(this.m_Model.Participant.SyncRoot)) {
             if (!(this.m_Model.Participant.Role is InstructorModel))
             {
                 this.m_Model.Participant.Role = new InstructorModel(Guid.NewGuid());
             }
         }
         using (Synchronizer.Lock(this.m_Model.ViewerState.SyncRoot)) {
             this.m_Model.ViewerState.iRole = 0;
         }
         if (this.m_Connection != null &&
             this.m_Connection.m_ManualConnectionPanel != null)
         {
             this.m_Connection.m_ManualConnectionPanel.DisconnectAllButtons();
         }
         this.m_StartJoinButton.Association = null;
         StartJoinButton2.StartEmptyPresentation(this.m_Model);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Constructs a properties form and hooks it into the model
        /// </summary>
        public StartupForm(PresenterModel model, ControlEventQueue dispatcher)
        {
            if (Screen.PrimaryScreen.Bounds.Height < 650)
            {
                //Alternate compact layout to work on netbooks or tablets with few vertical pixels
                short_mode         = true;
                this.GroupBoxSpace = 10;
            }

            // Setup the display of the form
            this.SuspendLayout();
            this.m_Model           = model;
            this.m_EventQueue      = dispatcher;
            this.AutoScaleBaseSize = new Size(5, 13);
            if (short_mode)
            {
                this.ClientSize = new Size(640, 360);
            }
            else
            {
                this.ClientSize = new Size(640, 480);
            }
            this.FormBorderStyle = FormBorderStyle.Sizable;//FixedDialog;
            this.Font            = Model.Viewer.ViewerStateModel.FormFont;
            this.AutoScroll      = true;
            this.Name            = "StartupForm";
            this.Text            = Strings.StartupFormText;
            this.MinimizeBox     = false;
            this.MaximizeBox     = false;

            // Add the child controls

            this.AddConnection();
            if (short_mode)
            {
                this.m_RoleGroup = new RoleGroup(new Point(this.GroupBoxLeft, this.GroupBoxSpace), new Size(240, 83), this.m_Model, this, true);
            }
            else
            {
                this.m_RoleGroup = new RoleGroup(new Point(this.GroupBoxLeft, this.GroupBoxSpace), new Size(240, 110), this.m_Model, this, false);
            }
            this.m_RoleGroup.Font = Model.Viewer.ViewerStateModel.StringFont;
            this.Controls.Add(this.m_RoleGroup);


            //Tab control stuff
            this.m_UDPPanel = new UDPPanel();

            if (short_mode)
            {
                this.m_TabControl = new StartupTabControl(new Size(560, 150),
                                                          new Point(this.GroupBoxLeft, 15), 0, this, this.m_Model, this.m_EventQueue);
            }
            else
            {
                this.m_TabControl = new StartupTabControl(new Size(560, 200),
                                                          new Point(this.GroupBoxLeft, 15), 0, this, this.m_Model, this.m_EventQueue);
            }
            this.m_TabGroupBox           = new GroupBox();
            this.m_TabGroupBox.FlatStyle = FlatStyle.System;
            this.m_TabGroupBox.Font      = Model.Viewer.ViewerStateModel.StringFont;
            this.m_TabGroupBox.Size      = new Size(this.m_TabControl.Size.Width + 2 * this.GroupBoxLeft,
                                                    this.m_TabControl.Size.Height + 2 * this.GroupBoxSpace);
            this.m_TabGroupBox.Location = new Point(this.GroupBoxLeft, this.m_RoleGroup.Bottom + this.GroupBoxSpace);
            this.Controls.Add(this.m_TabGroupBox);

            this.m_TabGroupBox.Controls.Add(this.m_TabControl);
            //end tab control stuff

            //Begin StartJoinButton stuff
            this.m_StartJoinButton          = new StartJoinButton2(this.m_Model, this, short_mode);
            this.m_StartJoinButton.Location = new Point(this.GroupBoxLeft, this.GroupBoxSpace + 4);

            this.m_ButtonGroupBox           = new GroupBox();
            this.m_ButtonGroupBox.FlatStyle = FlatStyle.System;
            this.m_ButtonGroupBox.Font      = Model.Viewer.ViewerStateModel.StringFont;
            this.m_ButtonGroupBox.Size      = new Size(this.m_StartJoinButton.Size.Width + 2 * this.GroupBoxLeft,
                                                       this.m_StartJoinButton.Size.Height + 2 * this.GroupBoxSpace);
            this.m_ButtonGroupBox.Location = new Point(this.GroupBoxLeft,
                                                       this.m_TabGroupBox.Bottom + this.GroupBoxSpace);
            this.Controls.Add(this.m_ButtonGroupBox);

            this.m_ButtonGroupBox.Controls.Add(this.m_StartJoinButton);
            //End StartJoinButton stuff


            this.m_EnableExternalMonitorCheckbox = new EnableExternalMonitorCheckbox(
                new Point(300, ((this.m_RoleGroup.Top + this.m_RoleGroup.Bottom) / 2) - 20),
                new Size(300, 50), m_Model, this.m_EventQueue, this);
            this.Controls.Add(this.m_EnableExternalMonitorCheckbox);

            this.m_HelpButton          = new Cp3HelpButton();
            this.m_HelpButton.Font     = Model.Viewer.ViewerStateModel.StringFont1;
            this.m_HelpButton.Location = new Point((this.m_StartJoinButton.Right + this.Width) / 2,
                                                   (this.m_ButtonGroupBox.Top + this.m_ButtonGroupBox.Bottom) / 2 - 10);
            this.Controls.Add(this.m_HelpButton);

            this.m_StartJoinButton.HandleEnabled();//Can't call this until after other things are created. (ie until after AddConnection is called)

            this.m_RoleChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.OnRoleChanged));
            this.m_Model.ViewerState.Changed["iRole"].Add(this.m_RoleChangedDispatcher.Dispatcher);
            this.FormClosing += new FormClosingEventHandler(StartupForm_FormClosing);
            this.ResumeLayout();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Constructs a properties form and hooks it into the model
        /// </summary>
        public StartupForm(PresenterModel model, ControlEventQueue dispatcher)
        {
            if (Screen.PrimaryScreen.Bounds.Height < 650) {
                //Alternate compact layout to work on netbooks or tablets with few vertical pixels
                short_mode = true;
                this.GroupBoxSpace = 10;
            }

            // Setup the display of the form
            this.SuspendLayout();
            this.m_Model = model;
            this.m_EventQueue = dispatcher;
            this.AutoScaleBaseSize = new Size(5, 13);
            if (short_mode) {
                this.ClientSize = new Size(640, 360);
            }
            else {
                this.ClientSize = new Size(640, 480);
            }
            this.FormBorderStyle = FormBorderStyle.Sizable;//FixedDialog;
            this.Font = Model.Viewer.ViewerStateModel.FormFont;
            this.AutoScroll = true;
            this.Name = "StartupForm";
            this.Text = Strings.StartupFormText;
            this.MinimizeBox = false;
            this.MaximizeBox = false;

            // Add the child controls

            this.AddConnection();
            if (short_mode) {
                this.m_RoleGroup = new RoleGroup(new Point(this.GroupBoxLeft, this.GroupBoxSpace), new Size(240, 83), this.m_Model, this, true);
            }
            else {
                this.m_RoleGroup = new RoleGroup(new Point(this.GroupBoxLeft, this.GroupBoxSpace), new Size(240, 110), this.m_Model, this, false);
            }
            this.m_RoleGroup.Font = Model.Viewer.ViewerStateModel.StringFont;
            this.Controls.Add(this.m_RoleGroup);

            //Tab control stuff
            this.m_UDPPanel = new UDPPanel();

            if (short_mode) {
                this.m_TabControl = new StartupTabControl(new Size(560, 150),
                    new Point(this.GroupBoxLeft, 15), 0, this, this.m_Model, this.m_EventQueue);
            }
            else {
                this.m_TabControl = new StartupTabControl(new Size(560, 200),
                    new Point(this.GroupBoxLeft, 15), 0, this, this.m_Model, this.m_EventQueue);

            }
            this.m_TabGroupBox = new GroupBox();
            this.m_TabGroupBox.FlatStyle = FlatStyle.System;
            this.m_TabGroupBox.Font = Model.Viewer.ViewerStateModel.StringFont;
            this.m_TabGroupBox.Size = new Size(this.m_TabControl.Size.Width + 2 * this.GroupBoxLeft,
                this.m_TabControl.Size.Height + 2 * this.GroupBoxSpace);
            this.m_TabGroupBox.Location = new Point(this.GroupBoxLeft, this.m_RoleGroup.Bottom + this.GroupBoxSpace);
            this.Controls.Add(this.m_TabGroupBox);

            this.m_TabGroupBox.Controls.Add(this.m_TabControl);
            //end tab control stuff

            //Begin StartJoinButton stuff
            this.m_StartJoinButton = new StartJoinButton2(this.m_Model, this, short_mode);
            this.m_StartJoinButton.Location = new Point(this.GroupBoxLeft, this.GroupBoxSpace + 4);

            this.m_ButtonGroupBox = new GroupBox();
            this.m_ButtonGroupBox.FlatStyle = FlatStyle.System;
            this.m_ButtonGroupBox.Font = Model.Viewer.ViewerStateModel.StringFont;
            this.m_ButtonGroupBox.Size = new Size(this.m_StartJoinButton.Size.Width + 2 * this.GroupBoxLeft,
                this.m_StartJoinButton.Size.Height + 2 * this.GroupBoxSpace);
            this.m_ButtonGroupBox.Location = new Point(this.GroupBoxLeft,
                this.m_TabGroupBox.Bottom + this.GroupBoxSpace);
            this.Controls.Add(this.m_ButtonGroupBox);

            this.m_ButtonGroupBox.Controls.Add(this.m_StartJoinButton);
            //End StartJoinButton stuff

            this.m_EnableExternalMonitorCheckbox = new EnableExternalMonitorCheckbox(
                new Point(300, ((this.m_RoleGroup.Top + this.m_RoleGroup.Bottom) / 2) - 20),
                new Size(300, 50), m_Model, this.m_EventQueue, this);
            this.Controls.Add(this.m_EnableExternalMonitorCheckbox);

            this.m_HelpButton = new Cp3HelpButton();
            this.m_HelpButton.Font = Model.Viewer.ViewerStateModel.StringFont1;
            this.m_HelpButton.Location = new Point((this.m_StartJoinButton.Right + this.Width) / 2,
                (this.m_ButtonGroupBox.Top +this.m_ButtonGroupBox.Bottom)/2 -10);
            this.Controls.Add(this.m_HelpButton);

            this.m_StartJoinButton.HandleEnabled();//Can't call this until after other things are created. (ie until after AddConnection is called)

            this.m_RoleChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.OnRoleChanged));
            this.m_Model.ViewerState.Changed["iRole"].Add(this.m_RoleChangedDispatcher.Dispatcher);
            this.FormClosing += new FormClosingEventHandler(StartupForm_FormClosing);
            this.ResumeLayout();
        }