private void FlushPackets(int stylusId, int strokeId)
        {
            using (Synchronizer.Lock(this)) {
                List <int> buffer;
                if (this.PacketBuffers.TryGetValue(stylusId, out buffer) && buffer.Count != 0)
                {
                    int[] packets = buffer.ToArray();

                    buffer.Clear();

                    if (ViewerStateModel.NonStandardDpi)
                    {
                        RealTimeInkSheetModel.ScalePackets(packets, ViewerStateModel.DpiNormalizationSendMatrix);
                    }

                    // FIXME: Dispatch to the SendingQueue's thread.
                    Message message = new RealTimeInkSheetPacketsMessage(this.m_Sheet, stylusId, strokeId, packets);
                    message.Tags                = new MessageTags();
                    message.Tags.SlideID        = m_SlideID;
                    message.Tags.Priority       = MessagePriority.RealTime;
                    message.Tags.BridgePriority = MessagePriority.RealTime;
                    this.Sender.Send(message, MessagePriority.RealTime);
                }

                this.PacketFlushTimes[stylusId] = DateTime.Now.Ticks;
            }
        }
Ejemplo n.º 2
0
        protected override bool UpdateTarget(ReceiveContext context)
        {
            RealTimeInkSheetModel sheet = this.Target as RealTimeInkSheetModel;

            if (sheet != null)
            {
                if (ViewerStateModel.NonStandardDpi)
                {
                    RealTimeInkSheetModel.ScalePackets(this.Packets, ViewerStateModel.DpiNormalizationReceiveMatrix);
                }
                sheet.OnStylusUp(this.StylusId, this.StrokeId, this.Packets);
            }
            return(false);
        }
Ejemplo n.º 3
0
        protected override bool UpdateTarget(ReceiveContext context)
        {
            RealTimeInkSheetModel sheet = this.Target as RealTimeInkSheetModel;

            if (sheet != null)
            {
                if (ViewerStateModel.NonStandardDpi)
                {
                    RealTimeInkSheetModel.ScalePackets(this.Packets, ViewerStateModel.DpiNormalizationReceiveMatrix);
                }

                sheet.OnStylusDown(this.StylusId, this.StrokeId, this.Packets, this.TabletProperties.CreateTabletPropertyDescriptionCollection());
            }
            return(false);
        }
        private void HandleStylusUpHelper(object sender, int stylusId, int strokeId, int[] packets)
        {
            this.FlushPackets(stylusId, strokeId);

            if (ViewerStateModel.NonStandardDpi)
            {
                RealTimeInkSheetModel.ScalePackets(packets, ViewerStateModel.DpiNormalizationSendMatrix);
            }

            Message message = new RealTimeInkSheetStylusUpMessage(this.m_Sheet, stylusId, strokeId, packets);

            message.Tags                = new MessageTags();
            message.Tags.SlideID        = m_SlideID;
            message.Tags.Priority       = MessagePriority.RealTime;
            message.Tags.BridgePriority = MessagePriority.RealTime;
            this.Sender.Send(message, MessagePriority.RealTime);
        }