/// <summary> /// Construct the sheet message /// </summary> /// <param name="sheet">The sheet to construct the message from</param> /// <param name="collection">The collection that this sheet is part of</param> public QuickPollSheetMessage( QuickPollSheetModel sheet, SheetCollection collection ) : base(sheet, collection) { using( Synchronizer.Lock( sheet.SyncRoot ) ) { this.Id = sheet.QuickPoll.Id; } }
/// <summary> /// Handle this messsage being received and add this sheet to the appropriate place. /// </summary> /// <param name="context">The receiving context</param> /// <returns>True if handled, false otherwise</returns> protected override bool UpdateTarget( ReceiveContext context ) { QuickPollSheetModel sheet = this.Target as QuickPollSheetModel; if( sheet == null ) { // Create a new sheet using( context.Model.Workspace.Lock() ) { if( (~context.Model.Workspace.CurrentPresentation) != null ) { using( Synchronizer.Lock( (~context.Model.Workspace.CurrentPresentation).SyncRoot ) ) { this.Target = sheet = new QuickPollSheetModel( ((Guid)this.TargetId), (~context.Model.Workspace.CurrentPresentation).QuickPoll ); } } else { using( Synchronizer.Lock( context.Participant.SyncRoot ) ) { if( context.Participant.Role is Model.Network.InstructorModel ) { using( Synchronizer.Lock( context.Participant.Role.SyncRoot ) ) { using( Synchronizer.Lock( ((Model.Network.InstructorModel)context.Participant.Role).CurrentPresentation.SyncRoot ) ) { this.Target = sheet = new QuickPollSheetModel( ((Guid)this.TargetId), ((Model.Network.InstructorModel)context.Participant.Role).CurrentPresentation.QuickPoll ); } } } } } } } // Update the parameters of the sheet using( Synchronizer.Lock( sheet.SyncRoot ) ) { sheet.QuickPollId = this.Id; } base.UpdateTarget( context ); return true; }
/// <summary> /// Construct the renderer /// </summary> /// <param name="display">The SlideDisplayModel</param> /// <param name="sheet">The QuickPollSheetModel</param> public QuickPollSheetRenderer( SlideDisplayModel display, QuickPollSheetModel sheet) : base(display, sheet) { this.m_Sheet = sheet; repaint_dispatcher_ = new EventQueue.PropertyEventDispatcher(SlideDisplay.EventQueue, this.Repaint); /// Add event listeners this.m_Sheet.QuickPoll.Changed["Updated"].Add(new PropertyEventHandler(this.repaint_dispatcher_.Dispatcher)); this.SlideDisplay.Changed["Slide"].Add(new PropertyEventHandler(this.repaint_dispatcher_.Dispatcher)); }
public QuickPollSheetNetworkService( SendingQueue sender, PresentationModel presentation, DeckModel deck, SlideModel slide, QuickPollSheetModel sheet, SheetMessage.SheetCollection selector ) : base(sender, presentation, deck, slide, sheet, selector) { this.sheet = sheet; this.m_SlideModel = slide; }