Пример #1
0
 public override bool Equals(object obj)
 {
     if (obj is QueueElement)
     {
         QueueElement el = (QueueElement)obj;
         return(el.Url == Url && el.Destination == Destination && el.Completed == Completed && el.Id == Id);
     }
     return(false);
 }
Пример #2
0
        void createNextDownload()
        {
            QueueElement elt = getFirstNotCompletedElement();

            if (string.IsNullOrEmpty(elt.Url))
            {
                return;
            }
            indirici = new HTTPDownloader(elt.Url, elt.Destination);
            indirici.DownloadCompleted       += indirici_DownloadCompleted;
            indirici.DownloadProgressChanged += indirici_DownloadProgressChanged;
            indirici.StartAsync();
            currentElement   = elt;
            queuePaused      = false;
            startEventRaised = false;
        }
Пример #3
0
 /// <summary>
 /// Deletes the queue element at the given index
 /// </summary>
 /// <param name="index">The index of the element that will be deleted</param>
 public void Delete(int index)
 {
     if (elements[index].Equals(currentElement) && indirici != null)
     {
         indirici.Cancel();
         currentElement = new QueueElement()
         {
             Url = ""
         };
     }
     elements.RemoveAt(index);
     if (!queuePaused)
     {
         createNextDownload();
     }
 }
Пример #4
0
        void indirici_DownloadCompleted(object sender, EventArgs e)
        {
            if (QueueElementCompleted != null)
            {
                QueueElementCompleted(this, new QueueElementCompletedEventArgs(this.CurrentIndex));
            }
            for (int i = 0; i < elements.Count; i++)
            {
                if (elements[i].Equals(currentElement))
                {
                    elements[i] = new QueueElement()
                    {
                        Id          = elements[i].Id,
                        Url         = elements[i].Url,
                        Destination = elements[i].Destination,
                        Completed   = true
                    };
                    break;
                }
            }

            createNextDownload();
        }