static void AddItem(ArrivedPacket packet) { if (!MainWindow.ListViewPackets.Items.CheckAccess()) { MainWindow.ListViewPackets.Items.Dispatcher.Invoke(new Action <ArrivedPacket>(AddItem), packet); } else { MainWindow.ListViewPackets.Items.Add(packet); } }
private void ListViewPackets_SelectionChanged(object sender, SelectionChangedEventArgs e) { textBoxPacket.Text = ""; textBoxPacket1.Text = ""; ArrivedPacket packet = (ArrivedPacket)listViewPackets.SelectedItem; if (packet == null) { return; } textBoxPacket.Text = Encoding.UTF8.GetString(packet.PacketData.Bytes); textBoxPacket1.Text = BitConverter.ToString(packet.PacketData.Bytes); //dataGridPacket.ItemsSource = packet.PacketData; //listViewPackets.SelectedItem }