public RoleSynchronizer(SlideViewer sv, ParticipantModel pm) { this.m_SlideViewer = sv; this.m_Participant = pm; this.m_Participant.Changed["Role"].Add(new PropertyEventHandler(this.onRoleChange)); this.onRoleChange(this, null); }
public PreviewTraversalModelAdapter(ControlEventQueue dispatcher, SlideViewer viewer, PresenterModel model) { this.m_EventQueue = dispatcher; this.m_Model = model; this.m_Viewer = viewer; this.m_CurrentSlidePreviewDeckTraversalChangedDispatcher = this.m_Model.Workspace.CurrentSlidePreviewDeckTraversal.ListenAndInitialize(dispatcher, delegate(Property<DeckTraversalModel>.EventArgs args) { this.CurrentSlidePreviewDeckTraversal = args.New; }); }
/// <summary> /// Constructs this control /// </summary> public SlidePreview(PresenterModel model, Control linked) { this.m_Model = model; this.m_EventQueue = new ControlEventQueue(this); this.m_Linked = linked; this.m_Linked.SizeChanged += new EventHandler(this.OnLinkedControlSizeChanged); this.m_Linked.LocationChanged += new EventHandler(this.OnLinkedControlSizeChanged); this.m_Linked.DockChanged += new EventHandler(this.OnLinkedControlSizeChanged); //this.OnLinkedControlSizeChanged(this, EventArgs.Empty); // Create the control's properties this.SuspendLayout(); this.Name = "SlidePreview"; this.Visible = false; this.BackColor = System.Drawing.Color.Black; this.DockPadding.All = 4; this.m_PreviewSlideViewer = new MainSlideViewer(this.m_Model, false); this.m_PreviewSlideViewer.Dock = DockStyle.Fill; //Set the disposition to always be public using (Synchronizer.Lock(this.m_PreviewSlideViewer.SlideDisplay.SyncRoot)) { this.m_PreviewSlideViewer.SlideDisplay.SheetDisposition = Model.Presentation.SheetDisposition.SecondMonitor; } //Listen to changes in the role this.m_Model.Participant.Changed["Role"].Add(new PropertyEventHandler(this.onRoleChange)); //Set the initial role this.onRoleChange(this, null); this.m_SlidePreviewChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleSlidePreviewChanged)); this.m_Model.ViewerState.Changed["SlidePreviewEnabled"].Add(this.m_SlidePreviewChangedDispatcher.Dispatcher); this.m_Model.ViewerState.Changed["SlidePreviewVisible"].Add(this.m_SlidePreviewChangedDispatcher.Dispatcher); this.m_SlidePreviewSizeChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleSlidePreviewSizeChanged)); this.m_Model.ViewerState.Changed["SlidePreviewWidth"].Add(this.m_SlidePreviewSizeChangedDispatcher.Dispatcher); this.m_Model.ViewerState.Changed["SlidePreviewHeight"].Add(this.m_SlidePreviewSizeChangedDispatcher.Dispatcher); this.Controls.Add(this.m_PreviewSlideViewer); // Initialize the SlidePreview's visibility. this.m_SlidePreviewChangedDispatcher.Dispatcher(this, null); this.m_SlidePreviewSizeChangedDispatcher.Dispatcher(this, null); this.ResumeLayout(); // Create the control immediately, or else event queue will never execute anything (chicken and the egg). this.CreateHandle(); }
/// <summary> /// Creates a new instance of a second monitor form /// </summary> /// <param name="model"> /// Presenter model to display the second monitor form on /// </param> public SecondMonitorForm( PresenterModel model ) { // Assign the model this.m_Model = model; // Layout the control this.SuspendLayout(); // Set the parameters of the form this.AccessibleDescription = "secondMonitorForm"; this.AccessibleName = "secondMonitorForm"; this.BackColor = System.Drawing.Color.White; this.Enabled = false; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.ShowInTaskbar = false; this.Visible = false; this.DesktopBounds = Screen.PrimaryScreen.Bounds; this.Name = "SecondMonitorForm"; this.Text = "Classroom Presenter 3 Dual-Monitor Display"; // Create the second monitor view this.m_SecondMonitorSlideViewer = new SecondMonitorSlideViewer(this.m_Model); this.m_SecondMonitorSlideViewer.Dock = DockStyle.Fill; //Set the disposition to always be public using(Synchronizer.Lock(this.m_SecondMonitorSlideViewer.SlideDisplay.SyncRoot)) { this.m_SecondMonitorSlideViewer.SlideDisplay.SheetDisposition = Model.Presentation.SheetDisposition.SecondMonitor | Model.Presentation.SheetDisposition.All | Model.Presentation.SheetDisposition.Background | Model.Presentation.SheetDisposition.Public; } // Attach the traversal and rendering of the second monitor to the model this.m_WorkspaceModelAdapter = new WorkspaceModelAdapter(this.m_SecondMonitorSlideViewer.SlideDisplay.EventQueue, this.m_SecondMonitorSlideViewer, this.m_Model); // Add the control this.Controls.Add( this.m_SecondMonitorSlideViewer ); this.ResumeLayout(); // Keep track of changes to the number of monitors and whether the second monitor is enabled this.m_Model.ViewerState.Changed["NumberOfScreens"].Add(new PropertyEventHandler(this.HandleViewerStateChanged)); this.m_Model.ViewerState.Changed["SecondMonitorEnabled"].Add(new PropertyEventHandler(this.HandleViewerStateChanged)); this.HandleViewerStateChanged(this.m_Model.ViewerState, null); }