Esempio n. 1
0
 private void UpdateWithParsedPacket(List <ListViewModel> data)
 {
     foreach (var model in data)
     {
         _packets.Add(model);
         _packets[_packets.Count - 1].PacketListView.Index = (uint)_packets.Count - 1;
         PacketsListView.Dispatcher.Invoke(DispatcherPriority.Normal, (Action) delegate
         {
             PacketsListView.Items.Add(model.PacketListView);
             PacketsListView.ScrollIntoView(PacketsListView.Items[PacketsListView.Items.Count - 1]);
         });
     }
 }
Esempio n. 2
0
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            var opcode = SearchBox.Text.Trim();

            if (string.IsNullOrEmpty(opcode) || opcode.Length <= 0 || opcode == "0")
            {
                _backupIndex = (PacketListView)PacketsListView.SelectedItem;
                LogReadFinished(_backupPackets);
                _packets = _backupPackets.ToList();
                _backupPackets.Clear();
                if (_backupIndex != null)
                {
                    PacketsListView.ScrollIntoView(_backupIndex);
                    PacketsListView.SelectedIndex = (int)_backupIndex.Index;
                    _backupIndex = null;
                }

                return;
            }

            if (opcode.Contains("0x"))
            {
                opcode = Parser.ParseLong(opcode).ToString();
            }

            if (_backupPackets.Count <= 0)
            {
                _backupPackets = _packets.ToList();
            }

            _packets.Clear();
            PacketsListView.Items.Clear();

            var list = new List <ListViewModel>();

            foreach (var packet in _backupPackets)
            {
                if (packet.PacketListView.Opcode == opcode)
                {
                    list.Add(packet);
                }
            }

            LogReadFinished(list);
        }