Ejemplo n.º 1
0
        private void _fileTransferManager_UpdateTransfer(FileTransferManager sender, FileTransfer fileTransfer)
        {
            Invoke((MethodInvoker) delegate
            {
                ListViewItem item    = lstTransfers.Items.Cast <ListViewItem>().FirstOrDefault(i => (string)i.Tag == fileTransfer.TransferId);
                ProgressBar progress = lstTransfers.Controls.OfType <ProgressBar>().FirstOrDefault(p => (string)p.Tag == fileTransfer.TransferId);

                progress.Value = fileTransfer.CalculatePercentage();
                item.SubItems[item.SubItems.Count - 3].Text = Explorer.GetSize(fileTransfer.Transferred());
                item.SubItems[item.SubItems.Count - 2].Text = Explorer.GetSize(fileTransfer.BytesPerSecond);

                if (!fileTransfer.Transfering)
                {
                    item.SubItems[1].Text = "Completed";
                    item.ForeColor        = Color.Green;
                }
            });
        }