Beispiel #1
0
 private void UpdateDownLoadList_Timer_Tick(object sender, EventArgs e)
 {
     DownloadListView.BeginUpdate();
     //DownloadListView.Items.Clear();
     for (int i = 0; i < DownloadList.Count; i++)
     {
         HttpDownload download = (HttpDownload)DownloadList[i];
         DownloadListView.Items[i].SubItems[2].Text = (getSizeMB((long)download.getSpeed()) < 1 ? (download.getSpeed() / 1024) + "K/s" : getSizeMB((long)download.getSpeed()) + "M/s");
         DownloadListView.Items[i].SubItems[3].Text = download.getDownloadPercentage() + "%";
         DownloadListView.Items[i].SubItems[4].Text = download.Stop?"已终止":download.Paste?"暂停中":(download.DownloadComplete() ? "下载完成" : "下载中");
     }
     DownloadListView.EndUpdate();
     return;
 }
Beispiel #2
0
 private void UpdateDownLoadList_Timer_Tick(object sender, EventArgs e)
 {
     DownloadListView.BeginUpdate();
     foreach (HttpDownload Task in TaskManager.GetTastManager.GetTaskList())
     {
         if (DownloadListView.Items.Count == Task.ID)
         {
             ListViewItem item = new ListViewItem();
             item.Text = Task.ID.ToString();
             item.SubItems.Add(Task.DownloadPath.Split('\\')[Task.DownloadPath.Split('\\').Length - 1]);
             item.SubItems.Add(Task.DownloadPath);
             item.SubItems.Add((getSizeMB((long)Task.Speed) < 1 ? (Task.Speed / 1024) + "K/s" : getSizeMB((long)Task.Speed) + "M/s"));
             item.SubItems.Add(Task.Percentage + "%");
             item.SubItems.Add(Task.Downloading?"下载中":"停止中");
             DownloadListView.Items.Add(item);
             continue;
         }
         DownloadListView.Items[Task.ID].SubItems[3].Text = (getSizeMB((long)Task.Speed) < 1 ? (Task.Speed / 1024) + "K/s" : getSizeMB((long)Task.Speed) + "M/s");
         DownloadListView.Items[Task.ID].SubItems[4].Text = Task.Percentage + "%";
         DownloadListView.Items[Task.ID].SubItems[5].Text = Task.Downloading ? "下载中" : "停止中";
     }
     DownloadListView.EndUpdate();
     return;
 }
Beispiel #3
0
 private void UpdateDownLoadList_Timer_Tick(object sender, EventArgs e)
 {
     DownloadListView.BeginUpdate();
     foreach (HttpTask Task in TaskManager.GetTastManager.GetTasks())
     {
         if (DownloadListView.Items.Count == Task.ID)
         {
             ListViewItem item = new ListViewItem();
             item.Text = Task.ID.ToString();
             item.SubItems.Add(Task.FileName);
             item.SubItems.Add(Task.FilePath);
             item.SubItems.Add((getSizeMB((long)Task.GetSpeed()) < 1 ? (Task.GetSpeed() / 1024) + "K/s" : getSizeMB((long)Task.GetSpeed()) + "M/s"));
             item.SubItems.Add(Task.GetPercentage() + "%");
             item.SubItems.Add(Task.State);
             DownloadListView.Items.Add(item);
             continue;
         }
         DownloadListView.Items[Task.ID].SubItems[3].Text = (getSizeMB((long)Task.GetSpeed()) < 1 ? (Task.GetSpeed() / 1024) + "K/s" : getSizeMB((long)Task.GetSpeed()) + "M/s");
         DownloadListView.Items[Task.ID].SubItems[4].Text = Task.GetPercentage() + "%";
         DownloadListView.Items[Task.ID].SubItems[5].Text = Task.State;
     }
     DownloadListView.EndUpdate();
     return;
 }
Beispiel #4
0
        private void UpdateDownLoadList_Timer_Tick(object sender, EventArgs e)
        {
            DownloadListView.BeginUpdate();
            //DownloadListView.Items.Clear();

            foreach (HttpTask Task in TaskManager.GetTastManager.GetTasks())
            {
                if (DownloadListView.Items.Count == Task.ID)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = Task.ID.ToString();
                    item.SubItems.Add(Task.FileName);
                    item.SubItems.Add(Task.FilePath);
                    item.SubItems.Add((getSizeMB((long)Task.GetSpeed()) < 1 ? (Task.GetSpeed() / 1024) + "K/s" : getSizeMB((long)Task.GetSpeed()) + "M/s"));
                    item.SubItems.Add(Task.GetPercentage() + "%");
                    item.SubItems.Add(Task.State);
                    DownloadListView.Items.Add(item);
                    continue;
                }
                DownloadListView.Items[Task.ID].SubItems[3].Text = (getSizeMB((long)Task.GetSpeed()) < 1 ? (Task.GetSpeed() / 1024) + "K/s" : getSizeMB((long)Task.GetSpeed()) + "M/s");
                DownloadListView.Items[Task.ID].SubItems[4].Text = Task.GetPercentage() + "%";
                DownloadListView.Items[Task.ID].SubItems[5].Text = Task.State;
            }

            /*
             * for(int i = 0; i < DownloadList.Count; i++)
             * {
             *  HttpDownload download = (HttpDownload)DownloadList[i];
             *  DownloadListView.Items[i].SubItems[2].Text = (getSizeMB((long)download.GetSpeed()) < 1 ? (download.GetSpeed() / 1024) + "K/s" : getSizeMB((long)download.GetSpeed()) + "M/s");
             *  DownloadListView.Items[i].SubItems[3].Text = download.GetPercentage() + "%";
             *  DownloadListView.Items[i].SubItems[4].Text = download.Stop?"已终止":download.Paste?"暂停中":(download.DownloadComplete() ? "下载完成" : "下载中");
             * }
             */
            DownloadListView.EndUpdate();
            return;
        }