/// <summary> /// Delete a text or image annotation. /// </summary> /// <param name="rtda"></param> private void ReceiveDeleteAnnotation(RTDeleteAnnotation rtda) { int slideIndex; slideIndex = slideMap.GetMapping(rtda.SlideIndex, rtda.DeckGuid); //Get the slide Slide s = SlideDeck.GetSlide(slideIndex); SlideOverlay so = SlideDeck.GetOverlay(slideIndex); //If the annotation is on the slide, delete it. lock (so.TextAnnotations) { if (so.TextAnnotations.ContainsKey(rtda.Guid)) { so.TextAnnotations.Remove(rtda.Guid); } } lock (so.DynamicImages) { if (so.DynamicImages.ContainsKey(rtda.Guid)) { so.DynamicImages.Remove(rtda.Guid); } } so.RefreshDynamicElements(); }
/// <summary> /// This is used when deleting annotation sheets: text or image /// </summary> /// <param name="sheetRemovedMessage"></param> /// <returns></returns> internal object AddSheetRemoved(UW.ClassroomPresenter.Network.Messages.Presentation.SheetRemovedMessage srm) { if ((srm.Parent == null) || !(srm.Parent is CP3Msgs.SlideInformationMessage)) { warning += "Failed to locate slide for a annotation sheet. Ignoring Text/image deletion "; return(null); } Guid slideId = (Guid)srm.Parent.TargetId; TableOfContents.TocEntry tocEntry = toc.LookupBySlideId(slideId); if (tocEntry == null) { warning += "Warning: Failed to find table of contents entry for a text annotation. Ignoring the annotation. "; return(null); } RTDeleteAnnotation rtdta = new RTDeleteAnnotation((Guid)srm.TargetId, tocEntry.DeckId, tocEntry.SlideIndex); return(rtdta); }
/// <summary> /// This could be a delete for a text annotation or a dynamically added image (so called Image Annotation). /// </summary> /// <param name="rtda"></param> private void FilterRTDeleteAnnotation(RTDeleteAnnotation rtda) { Guid guid = rtda.Guid; lock (subQueue) { //if annotation with this guid is found in low priority queue, remove it. //We assume there will never be more than one due to the way we enqueue annotations. for (int i = 0; i < subQueue.Count; i++) { if (((((WorkItem)subQueue[i]).OpCode == PacketType.RTTextAnnotation) || (((WorkItem)subQueue[i]).OpCode == PacketType.RTImageAnnotation)) && (((WorkItem)subQueue[i]).Guid == guid)) { subQueue.RemoveAt(i); break; } } } BufferChunk bc = new BufferChunk(Helpers.ObjectToByteArray(rtda)); enqueueMain(new WorkItem(bc, PacketType.RTDeleteTextAnnotation, rtda.SlideIndex, rtda.DeckGuid)); }