private void HandleInkDeletingHelper(string[] ids) { Message message, deck, slide, sheet; message = new PresentationInformationMessage(this.Presentation); message.InsertChild(deck = new DeckInformationMessage(this.Deck)); deck.InsertChild(slide = new SlideInformationMessage(GetSubmissionSlideModel(), false)); slide.InsertChild(sheet = new InkSheetStrokesDeletingMessage(this.m_Sheet, this.SheetCollectionSelector, ids)); this.Sender.Send(message); }
private void HandleInkDeletingHelper(string[] ids) { Message message, deck, slide, sheet; message = new PresentationInformationMessage(this.Presentation); message.InsertChild(deck = new DeckInformationMessage(this.Deck)); deck.InsertChild(slide = new SlideInformationMessage(this.Slide)); slide.InsertChild(sheet = new InkSheetStrokesDeletingMessage(this.m_Sheet, this.SheetCollectionSelector, ids)); message.Tags = new MessageTags(); message.Tags.SlideID = m_SlideID; message.Tags.BridgePriority = MessagePriority.Higher; this.Sender.Send(message); }
protected override MergeAction MergeInto(Message other_) { if (other_ is InkSheetStrokesDeletingMessage) { InkSheetStrokesDeletingMessage other = ((InkSheetStrokesDeletingMessage)other_); string[] merged = new string[this.StrokeIds.Length + other.StrokeIds.Length]; other.StrokeIds.CopyTo(merged, 0); this.StrokeIds.CopyTo(merged, other.StrokeIds.Length); this.StrokeIds = merged; return(MergeAction.DiscardOther); } else { return(base.MergeInto(other_)); } }
private void HandleInkDeletingHelper(string[] ids) { Message message, deck, slide, sheet; message = new PresentationInformationMessage(this.Presentation); message.InsertChild(deck = new DeckInformationMessage(this.Deck)); deck.InsertChild(slide = new SlideInformationMessage( GetSubmissionSlideModel(), false )); slide.InsertChild(sheet = new InkSheetStrokesDeletingMessage(this.m_Sheet, this.SheetCollectionSelector, ids)); this.Sender.Send(message); }
/// <summary> /// Return one or more RTDeleteStroke messages. /// </summary> /// <param name="issdm"></param> /// <returns></returns> internal List <object> AddInkSheetStrokesDeleting(UW.ClassroomPresenter.Network.Messages.Presentation.InkSheetStrokesDeletingMessage issdm) { //Resolve the SheetId to a slideId if (!sheetToSlideLookup.ContainsKey(issdm.TargetId)) { if (currentSlideId.Equals(Guid.Empty)) { warning += "Warning: Failed to lookup slide from sheet during ink erase operation."; return(null); } //Can we assume current slide?? Probably.. sheetToSlideLookup.Add(issdm.TargetId, currentSlideId); } //Use the slideId to get DeckID and Slide index from toc. Guid slideId = (Guid)sheetToSlideLookup[issdm.TargetId]; TableOfContents.TocEntry tocEntry = toc.LookupBySlideId(slideId); if (tocEntry == null) { warning += "Warning: InkSheetStrokesDeleted does not have a Toc entry. Ignoring erase. "; return(null); } if (issdm.StrokeIds.Length == 0) { return(null); } List <object> outputMessages = new List <object>(); //If more than one stroke, and count matches the total we have recorded for this slide, send one // message to erase all strokes. if (issdm.StrokeIds.Length > 1) { if (strokeCountsBySlideId.ContainsKey(slideId)) { if (strokeCountsBySlideId[slideId] == issdm.StrokeIds.Length) { strokeCountsBySlideId[slideId] = 0; RTEraseLayer rtel = new RTEraseLayer(tocEntry.DeckId, tocEntry.SlideIndex); Trace.WriteLine("*****Returning RTEraseLayer deck=" + tocEntry.DeckId.ToString() + ";slide=" + tocEntry.SlideIndex.ToString()); outputMessages.Add(rtel); //note: this message also takes care of any stray RT strokes, so clear this list: this.realTimeStrokesPending.Clear(); return(outputMessages); } } } //If there are any stray real-time strokes, delete them here. foreach (RTStrokeData rtsd in this.realTimeStrokesPending.Values) { outputMessages.Add(rtsd.GetRTDeleteStroke()); Debug.WriteLine("***** Deleting stray real-time stroke id=" + rtsd.StrokeId.ToString()); } this.realTimeStrokesPending.Clear(); //Delete individual strokes as indicated foreach (string s in issdm.StrokeIds) { Guid g = new Guid(s); RTDeleteStroke rtds = new RTDeleteStroke(g, tocEntry.DeckId, tocEntry.SlideIndex); outputMessages.Add(rtds); int strokesRemaining = -1; if ((strokeCountsBySlideId.ContainsKey(slideId)) && (strokeCountsBySlideId[slideId] > 0)) { strokeCountsBySlideId[slideId]--; strokesRemaining = strokeCountsBySlideId[slideId]; } Debug.WriteLine("***** Deleting static stroke id=" + g.ToString() + ";strokes remaining=" + strokesRemaining.ToString()); } return(outputMessages); }