Exemplo n.º 1
0
        /// <summary>
        /// 删除已选任务
        /// </summary>
        public void deleteSelectedTask()
        {
            bool hasChecked = false;

            foreach (Control c in flp_downloadTask.Controls)
            {
                if (c is DownloadListItem)
                {
                    DownloadListItem item = c as DownloadListItem;
                    if (item.isChecked)
                    {
                        hasChecked = true;
                        Law law = item.law;
                        if (law.isLocal == "1")
                        {
                            law.downloadPercent   = null;
                            law.downloadNodeCount = null;
                        }
                        else
                        {
                            law.isLocal           = "0";
                            law.downloadPercent   = null;
                            law.downloadNodeCount = null;
                        }
                        db.saveLaw(law);
                    }
                }
                if (hasChecked)
                {
                    reloadDownloadList();
                    reloadLawList();
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 恢复已选任务
 /// </summary>
 public void resumeSelectedTask()
 {
     foreach (Control c in flp_downloadTask.Controls)
     {
         if (c is DownloadListItem)
         {
             DownloadListItem item = c as DownloadListItem;
             if (item.isChecked)
             {
                 item.continueWork();
             }
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 加载下载列表
        /// </summary>
        public void loadDownLoadList()
        {
            removeFromFlp(flp_downloadTask);
            List <Law> list = db.getLaws(downloadFilter.queryParam).Where(l => l.downloadPercent != null).ToList();

            if (downloadFilter.cbb_sort.SelectedValue == null)//默认状态下按下载日期排序
            {
                list = list.OrderByDescending(l => l.downloadDate).ToList();
            }
            else if (downloadFilter.cbb_sort.SelectedValue.ToString() == "1")//选1时按下载日期排序
            {
                list = list.OrderByDescending(l => l.downloadDate).ToList();
            }
            foreach (Law law in list)
            {
                DownloadListItem item = new DownloadListItem();
                item.law        = law;
                item.parentForm = this;
                flp_downloadTask.Controls.Add(item);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 清除已完成任务
        /// </summary>
        public void clearDownloadedTask()
        {
            bool hasDownloaded = false;

            foreach (Control c in flp_downloadTask.Controls)
            {
                if (c is DownloadListItem)
                {
                    DownloadListItem item = c as DownloadListItem;
                    Law law = item.law;
                    if (law.isLocal == "1" && law.downloadPercent == 100)
                    {
                        hasDownloaded       = true;
                        law.downloadPercent = null;
                        db.saveLaw(law);
                    }
                }
            }
            if (hasDownloaded)
            {
                reloadDownloadList();
                reloadLawList();
            }
        }