示例#1
0
        void readerDevice_OnPacketArrival(object sender, CaptureEventArgs e)
        {
            rawCapturesList.Add(e.Packet);

            CustomerPacket curpacket = AchieiveNewPacket(e.Packet);

            if (packets == null)
            {
                packets = new ObservableCollection <CustomerPacket>();
                packets.Add(curpacket);
                this.ViewBody.ItemsSource = packets;
            }
            else
            {
                try
                {
                    //此处可能会有溢出
                    packets.Add(curpacket);
                }
                catch
                {
                    this.continueGetPacket = false;
                }
                finally
                {
                }
            }
        }
示例#2
0
        public void GetNextPacket()
        {
            RawCapture packet;

            // Capture packets using GetNextPacket()
            if ((packet = device.GetNextPacket()) != null)
            {
                captureFileWriter.Write(packet);


                rawCapturesList.Add(packet);

                CustomerPacket curpacket = AchieiveNewPacket(packet);
                if (packets == null)
                {
                    packets = new ObservableCollection <CustomerPacket>();
                    packets.Add(curpacket);
                    this.ViewBody.ItemsSource = packets;
                }
                else
                {
                    try
                    {
                        //此处可能会有溢出
                        packets.Add(curpacket);
                    }
                    catch
                    {
                        this.continueGetPacket = false;
                    }
                    finally
                    {
                    }
                }
            }

            if (this.continueGetPacket)
            {
                this.ViewBody.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new GetNextPacketDelegate(GetNextPacket));
            }
        }