예제 #1
0
        private void UpdateSegmentsWithoutInsert(SegmentDownloaderInfoCollection segmentDownloaderInfoCollection)
        {
            for (int i = 0; i < segmentDownloaderInfoCollection.Count; i++)
            {
                ISegmentDownloaderInfo segmentDownloaderInfo = segmentDownloaderInfoCollection[i];
                ListViewItem           listViewItem          = lvwDownloadTaskSegments.Items[i];
                listViewItem.SubItems[0].Text = string.Format("{0:0.##}%", segmentDownloaderInfo.DownloadProgress);
                listViewItem.SubItems[1].Text = ByteFormatter.ToString(segmentDownloaderInfo.TransferedDownload);
                listViewItem.SubItems[2].Text = ByteFormatter.ToString(segmentDownloaderInfo.EndPosition - segmentDownloaderInfo.StartPosition);
                listViewItem.SubItems[3].Text = ByteFormatter.ToString(segmentDownloaderInfo.StartPosition);
                listViewItem.SubItems[4].Text = ByteFormatter.ToString(segmentDownloaderInfo.EndPosition);
                listViewItem.SubItems[5].Text = string.Format("{0:0.##}", segmentDownloaderInfo.DownloadRate / 1024.0);
                listViewItem.SubItems[6].Text = TimeSpanFormatter.ToString(segmentDownloaderInfo.RemainingTime);
                listViewItem.SubItems[7].Text = segmentDownloaderInfo.LastException != null?string.Format(CultureInfo.CurrentCulture, "{0}, {1}", segmentDownloaderInfo.State, segmentDownloaderInfo.LastException.Message) : segmentDownloaderInfo.State.ToString();

                listViewItem.SubItems[8].Text = segmentDownloaderInfo.Uri.OriginalString;
            }
        }
예제 #2
0
        private void UpdateSegmentsInserting(ListViewItem newSelection, SegmentDownloaderInfoCollection segmentDownloaderInfoCollection)
        {
            m_LastDownloadTaskSelection = newSelection;

            lvwDownloadTaskSegments.Items.Clear();

            for (int i = 0; i < segmentDownloaderInfoCollection.Count; i++)
            {
                ListViewItem item = new ListViewItem();

                ISegmentDownloaderInfo segmentDownloaderInfo = segmentDownloaderInfoCollection[i];
                item.Text = string.Format("{0:0.##}%", segmentDownloaderInfo.DownloadProgress);
                item.SubItems.Add(ByteFormatter.ToString(segmentDownloaderInfo.TransferedDownload));
                item.SubItems.Add(ByteFormatter.ToString(segmentDownloaderInfo.EndPosition - segmentDownloaderInfo.StartPosition));
                item.SubItems.Add(ByteFormatter.ToString(segmentDownloaderInfo.StartPosition));
                item.SubItems.Add(ByteFormatter.ToString(segmentDownloaderInfo.EndPosition));
                item.SubItems.Add(string.Format("{0:0.##}", segmentDownloaderInfo.DownloadRate / 1024.0));
                item.SubItems.Add(TimeSpanFormatter.ToString(segmentDownloaderInfo.RemainingTime));
                item.SubItems.Add(segmentDownloaderInfo.State.ToString());
                item.SubItems.Add(segmentDownloaderInfo.Uri.OriginalString);

                lvwDownloadTaskSegments.Items.Add(item);
            }
        }
        private void UpdateSegmentsInserting(ListViewItem newSelection, SegmentDownloaderInfoCollection segmentDownloaderInfoCollection)
        {
            m_LastDownloadTaskSelection = newSelection;

            lvwDownloadTaskSegments.Items.Clear();

            for (int i = 0; i < segmentDownloaderInfoCollection.Count; i++)
            {
                ListViewItem item = new ListViewItem();

                ISegmentDownloaderInfo segmentDownloaderInfo = segmentDownloaderInfoCollection[i];
                item.Text = string.Format("{0:0.##}%", segmentDownloaderInfo.DownloadProgress);
                item.SubItems.Add(ByteFormatter.ToString(segmentDownloaderInfo.TransferedDownload));
                item.SubItems.Add(ByteFormatter.ToString(segmentDownloaderInfo.EndPosition - segmentDownloaderInfo.StartPosition));
                item.SubItems.Add(ByteFormatter.ToString(segmentDownloaderInfo.StartPosition));
                item.SubItems.Add(ByteFormatter.ToString(segmentDownloaderInfo.EndPosition));
                item.SubItems.Add(string.Format("{0:0.##}", segmentDownloaderInfo.DownloadRate / 1024.0));
                item.SubItems.Add(TimeSpanFormatter.ToString(segmentDownloaderInfo.RemainingTime));
                item.SubItems.Add(segmentDownloaderInfo.State.ToString());
                item.SubItems.Add(segmentDownloaderInfo.Uri.OriginalString);

                lvwDownloadTaskSegments.Items.Add(item);
            }
        }
 private void UpdateSegmentsWithoutInsert(SegmentDownloaderInfoCollection segmentDownloaderInfoCollection)
 {
     for (int i = 0; i < segmentDownloaderInfoCollection.Count; i++)
     {
         ISegmentDownloaderInfo segmentDownloaderInfo = segmentDownloaderInfoCollection[i];
         ListViewItem listViewItem = lvwDownloadTaskSegments.Items[i];
         listViewItem.SubItems[0].Text = string.Format("{0:0.##}%", segmentDownloaderInfo.DownloadProgress);
         listViewItem.SubItems[1].Text = ByteFormatter.ToString(segmentDownloaderInfo.TransferedDownload);
         listViewItem.SubItems[2].Text = ByteFormatter.ToString(segmentDownloaderInfo.EndPosition - segmentDownloaderInfo.StartPosition);
         listViewItem.SubItems[3].Text = ByteFormatter.ToString(segmentDownloaderInfo.StartPosition);
         listViewItem.SubItems[4].Text = ByteFormatter.ToString(segmentDownloaderInfo.EndPosition);
         listViewItem.SubItems[5].Text = string.Format("{0:0.##}", segmentDownloaderInfo.DownloadRate / 1024.0);
         listViewItem.SubItems[6].Text = TimeSpanFormatter.ToString(segmentDownloaderInfo.RemainingTime);        
         listViewItem.SubItems[7].Text = segmentDownloaderInfo.LastException != null ? string.Format(CultureInfo.CurrentCulture, "{0}, {1}", segmentDownloaderInfo.State, segmentDownloaderInfo.LastException.Message) : segmentDownloaderInfo.State.ToString();
         listViewItem.SubItems[8].Text = segmentDownloaderInfo.Uri.OriginalString;
     }
 }