private void RemoveListViewItem(ListViewItem lvi) { var item = lvi.Tag as TransferQueueItem; if (item.State == TransferQueueItem.TransferQueueItemStateEnum.Ready) { CurrentTransferQueue.RemoveFromQueue(item); } else if (item.State == TransferQueueItem.TransferQueueItemStateEnum.Error) { lvQueue.Items.Remove(lvi); } }