private void addNewVideoToList(Video video)
        {
            MyProgressBar progressBar = new MyProgressBar();

            progressBar.MinimumSize = progressBars.ImageSize;
            progressBar.MaximumSize = progressBars.ImageSize;
            progressBar.Size        = progressBars.ImageSize;
            if (progressBars.Images.IndexOfKey(video.getID()) == -1)
            {
                Bitmap progressBarBitmap = new Bitmap(progressBars.ImageSize.Width, progressBars.ImageSize.Height);
                progressBar.DrawToBitmap(progressBarBitmap, progressBarBounds);
                VideoListItem item = new VideoListItem(video, ref progressBarBitmap, ref progressBar);
                item.Font = new Font(lvActiveDownloads.Font, FontStyle.Regular);
                lvActiveDownloads.Items.Add(item);
                progressBars.Images.Add(video.getID(), progressBarBitmap);
                item.ImageKey = video.getID();
                Thread update = new Thread(() => updateInfo(item));
                update.IsBackground = true;
                update.Start();
            }
            else
            {
                Bitmap progressBarBitmap = (Bitmap)progressBars.Images[video.getID()];
                progressBar.DrawToBitmap(progressBarBitmap, progressBarBounds);
                VideoListItem item = new VideoListItem(video, ref progressBarBitmap, ref progressBar);
                item.Font = new Font(lvActiveDownloads.Font, FontStyle.Regular);
                lvActiveDownloads.Items.Add(item);
                progressBars.Images.Add(video.getID(), progressBarBitmap);
                item.ImageKey = video.getID();
                Thread update = new Thread(() => updateInfo(item));
                update.IsBackground = true;
                update.Start();
            }
        }
Example #2
0
 public VideoListItem(Video video, ref Bitmap PBBitmap, ref MyProgressBar PB)
 {
     this.PBBitmap = PBBitmap;
     this.PB       = PB;
     Tag           = video;
     SubItems.Add("jas");
     SubItems.Add("sum");
     SubItems.Add(video.getFormatForUpdate());
     SubItems.Add("gp");
     SubItems.Add("i");
     SubItems.Add("sum");
     SubItems.Add("najjak");
 }