Exemplo n.º 1
0
        public void StartNewTask(BookInfo book)
        {
            DownloadTaskElement de = new DownloadTaskElement(book, this);

            AddTaskElement(de);
            StartOneToDownload();
        }
Exemplo n.º 2
0
 public void AddTaskElement(DownloadTaskElement de)
 {
     taskList.Children.Add(de);
     if (de.isWaiting || de.isDownloading || de.isGettingSTR)
     {
         CurrentTask++;
     }
     IsEmpty = (taskList.Children.Count == 0);
 }
Exemplo n.º 3
0
 public void StopTask()
 {
     for (int i = 0; i < taskList.Children.Count; i++)
     {
         if (taskList.Children[i] is DownloadTaskElement)
         {
             DownloadTaskElement downloadelement = (DownloadTaskElement)taskList.Children[i];
             downloadelement.StopTask();
         }
     }
 }
Exemplo n.º 4
0
 public void RemoveTaskElement(DownloadTaskElement de)
 {
     taskList.Children.Remove(de);
     if (de.isWaiting || de.isDownloading || de.isGettingSTR || de.isError)
     {
         CurrentTask--;
     }
     if (de.isDownloading || de.isError || de.isGettingSTR)
     {
         StartOneToDownload();
     }
     IsEmpty = (taskList.Children.Count == 0);
 }
Exemplo n.º 5
0
        public void StartOneToDownload()
        {
            DownloadTaskElement de = null;

            for (int i = 0; i < taskList.Children.Count; i++)
            {
                de = (DownloadTaskElement)taskList.Children[i];
                if (de.Status == DownloadTaskElement.TaskStatus.Downloading || de.Status == DownloadTaskElement.TaskStatus.GettingSTR)
                {
                    break;
                }
                if (de.Status == DownloadTaskElement.TaskStatus.Waiting)
                {
                    de.StartDownload();
                    break;
                }
            }
        }
 public void StartNewTask(BookInfo book)
 {
     DownloadTaskElement de = new DownloadTaskElement(book, this);
     AddTaskElement(de);
     StartOneToDownload();
 }
 public void Finish(DownloadTaskElement sender)
 {
     CurrentTask--;
     StartOneToDownload();
     MainWindow.ShowMessage(String.Format("《{0}》下载完成",sender.Book.Title));
 }
 public void Exception(DownloadTaskElement sender)
 {
     StartOneToDownload();
     MainWindow.ShowMessage(String.Format("《{0}》下载出错", sender.Book.Title));
 }
 public void RemoveTaskElement(DownloadTaskElement de)
 {
     taskList.Children.Remove(de);
     if (de.isWaiting || de.isDownloading || de.isGettingSTR || de.isError)
         CurrentTask--;
     if (de.isDownloading || de.isError || de.isGettingSTR)
         StartOneToDownload();
     IsEmpty = (taskList.Children.Count == 0);
 }
Exemplo n.º 10
0
 public void AddTaskElement(DownloadTaskElement de)
 {
     taskList.Children.Add(de);
     if (de.isWaiting || de.isDownloading || de.isGettingSTR)
         CurrentTask++;
     IsEmpty = (taskList.Children.Count == 0);
 }
Exemplo n.º 11
0
 public void Finish(DownloadTaskElement sender)
 {
     CurrentTask--;
     StartOneToDownload();
     MainWindow.ShowMessage(String.Format("《{0}》下载完成", sender.Book.Title));
 }
Exemplo n.º 12
0
 public void Exception(DownloadTaskElement sender)
 {
     StartOneToDownload();
     MainWindow.ShowMessage(String.Format("《{0}》下载出错", sender.Book.Title));
 }