Esempio n. 1
0
        private void FilterRTDrawStroke(ArchiveRTNav.RTDrawStroke rtds)
        {
            Guid        guid = rtds.Guid;      //verify that this property is actually populated.
            BufferChunk data;

            lock (subQueue)
            {
                //if stroke with this guid is found in low priority queue, replace it, otherwise enqueue it.
                for (int i = 0; i < subQueue.Count; i++)
                {
                    if ((((WorkItem)subQueue[i]).OpCode == PacketType.Scribble) &&
                        (((WorkItem)subQueue[i]).Guid == guid))
                    {
                        subQueue.RemoveAt(i);
                        break;
                    }
                }
            }
            data = new BufferChunk(Helpers.ObjectToByteArray(rtds));
            WorkItem wi = new WorkItem(data, PacketType.Scribble, guid);

            wi.DeckGuid   = rtds.DeckGuid;
            wi.SlideIndex = rtds.SlideIndex;
            enqueueSub(wi);
        }
Esempio n. 2
0
        /// <summary>
        /// Receive Presenter2 stroke
        /// </summary>
        /// <param name="drawStroke"></param>
        public void ReceiveStroke(ArchiveRTNav.RTDrawStroke drawStroke)
        {
            int slideIndex;

            slideIndex = slideMap.GetMapping(drawStroke.SlideIndex, drawStroke.DeckGuid);
            InkScribble s = (InkScribble)this.SlideDeck.GetOverlay(slideIndex).Scribble;

            Ink.Stroke foundStroke;
            bool       found = FastFindStrokeFromGuid(s, drawStroke.Guid, out foundStroke, NEW_GUID_TAG);

            if (found)
            {
                s.Ink.DeleteStroke(foundStroke);
            }

            Ink.Ink ink = drawStroke.Ink;

            lock (this) {
                Rectangle r = ink.Strokes.GetBoundingBox();
                r.X      = (int)(r.X * XinkScaleFactor);
                r.Y      = (int)(r.Y * YinkScaleFactor);
                r.Width  = (int)(r.Width * XinkScaleFactor);
                r.Height = (int)(r.Height * YinkScaleFactor);
                s.Ink.AddStrokesAtRectangle(ink.Strokes, r);

                // Make note of the ink's strokes in the guidtable.
                // ASSUME that these strokes went on the end.
                int sCount   = s.Ink.Strokes.Count;
                int newCount = ink.Strokes.Count;
                for (int i = sCount - newCount; i < sCount; i++)
                {
                    Ink.Stroke stroke = s.Ink.Strokes[i];
                    if (stroke.ExtendedProperties.Contains(NEW_GUID_TAG))
                    {
                        Guid guid = Guid.Empty;
                        try {   //Saw this except once.  Couldn't repro.  Suspect corrupted data.
                            guid = new Guid((string)stroke.ExtendedProperties[NEW_GUID_TAG].Data);
                        }
                        catch {
                            continue;
                        }
                        this.myGuidTable[new ScribbleIntPair(s, stroke.Id)] = guid;
                        this.myGuidReverseTable[guid] = new ScribbleIntPair(s, stroke.Id);
                    }
                }
            }
        }