public static Message ForSheet(SheetModel sheet, SheetCollection collection) { if (sheet is ImageSheetModel) { //If it's an instructor note, return null. if (sheet.Disposition == SheetDisposition.Instructor) return null; else return new ImageSheetMessage((ImageSheetModel)sheet, collection); } if(sheet is RealTimeInkSheetModel) return new RealTimeInkSheetInformationMessage((RealTimeInkSheetModel) sheet, collection); if(sheet is InkSheetModel) return new InkSheetInformationMessage((InkSheetModel) sheet, collection); if(sheet is TextSheetModel) return new TextSheetMessage((TextSheetModel) sheet, collection); if( sheet is QuickPollSheetModel ) { Message poll; using( Synchronizer.Lock( sheet.SyncRoot ) ) { poll = new QuickPollInformationMessage( ((QuickPollSheetModel)sheet).QuickPoll ); } poll.InsertChild( new QuickPollSheetMessage( (QuickPollSheetModel)sheet, collection ) ); return poll; } throw new ArgumentException("Unknown sheet type: " + sheet.GetType().ToString()); }
/// <summary> /// Send a QuickPollResultInformationMessage to the appropriate receivers /// </summary> /// <param name="receivers">The group of people that should receive the update</param> private void SendResultChanged(Group receivers) { Message message, poll, res; message = new PresentationInformationMessage(this.m_Presentation); message.Group = receivers; poll = new QuickPollInformationMessage(this.m_QuickPoll); poll.Group = receivers; message.InsertChild(poll); res = new QuickPollResultInformationMessage(this.m_Result); res.Group = receivers; poll.InsertChild(res); this.m_Sender.Send(message); }
private void SendQuickPollSheetHelper( Group receivers ) { //Don't send message if it's an instructor note. if( this.sheet.Disposition != SheetDisposition.Instructor ) { Message message, deck, poll, slide; message = new PresentationInformationMessage( this.Presentation ); message.Group = receivers; message.InsertChild( deck = new DeckInformationMessage( this.Deck ) ); deck.InsertChild( slide = new SlideInformationMessage( this.Slide ) ); using( Synchronizer.Lock( this.Sheet.SyncRoot ) ) { slide.InsertChild( poll = new QuickPollInformationMessage( this.sheet.QuickPoll ) ); } poll.InsertChild( new QuickPollSheetMessage( this.sheet, this.SheetCollectionSelector ) ); using( Synchronizer.Lock( m_SlideModel.SyncRoot ) ) { message.Tags = new MessageTags(); message.Tags.SlideID = m_SlideModel.Id; } this.Sender.Send( message ); } }
public static Message ForSheet(SheetModel sheet, SheetCollection collection) { if (sheet is ImageSheetModel) { //If it's an instructor note, return null. if (sheet.Disposition == SheetDisposition.Instructor) { return(null); } else { return(new ImageSheetMessage((ImageSheetModel)sheet, collection)); } } if (sheet is RealTimeInkSheetModel) { return(new RealTimeInkSheetInformationMessage((RealTimeInkSheetModel)sheet, collection)); } if (sheet is InkSheetModel) { return(new InkSheetInformationMessage((InkSheetModel)sheet, collection)); } if (sheet is TextSheetModel) { return(new TextSheetMessage((TextSheetModel)sheet, collection)); } if (sheet is QuickPollSheetModel) { Message poll; using (Synchronizer.Lock(sheet.SyncRoot)) { poll = new QuickPollInformationMessage(((QuickPollSheetModel)sheet).QuickPoll); } poll.InsertChild(new QuickPollSheetMessage((QuickPollSheetModel)sheet, collection)); return(poll); } if (sheet is XPSPageSheetModel) { return(new XPSPageSheetMessage((XPSPageSheetModel)sheet, collection)); } throw new ArgumentException("Unknown sheet type: " + sheet.GetType().ToString()); }
private void SendQuickPollSheetHelper(Group receivers) { //Don't send message if it's an instructor note. if (this.sheet.Disposition != SheetDisposition.Instructor) { Message message, deck, poll, slide; message = new PresentationInformationMessage(this.Presentation); message.Group = receivers; message.InsertChild(deck = new DeckInformationMessage(this.Deck)); deck.InsertChild(slide = new SlideInformationMessage(this.Slide)); using (Synchronizer.Lock(this.Sheet.SyncRoot)) { slide.InsertChild(poll = new QuickPollInformationMessage(this.sheet.QuickPoll)); } poll.InsertChild(new QuickPollSheetMessage(this.sheet, this.SheetCollectionSelector)); using (Synchronizer.Lock(m_SlideModel.SyncRoot)) { message.Tags = new MessageTags(); message.Tags.SlideID = m_SlideModel.Id; } this.Sender.Send(message); } }
private void SendPollResultInformation( QuickPollResultModel result, Group receivers ) { Message message, poll, res; message = new PresentationInformationMessage( this.m_Service.m_Presentation ); message.Group = receivers; poll = new QuickPollInformationMessage( this.m_Service.m_QuickPoll ); poll.Group = receivers; message.InsertChild( poll ); res = new QuickPollResultInformationMessage( result ); res.Group = receivers; poll.InsertChild( res ); this.m_Service.m_Sender.Send( message ); }