public void OnDownloadTimedEvent(object source, ElapsedEventArgs e)
 {
     if (!Client.IsBusy && downloaQueue.Count > 0)
     {
         curentDownlodingFile = (DownloadFileObject)downloaQueue.Dequeue();
         Client.DownloadFileAsync(new Uri(curentDownlodingFile.Url), Path.GetTempPath() + @"\station.png");
     }
 }
        public void OnDownloadTimedEvent()
        {
            if (!Client.IsBusy && downloaQueue.Count > 0)
            {
                curentDownlodingFile = (DownloadFileObject)downloaQueue.Dequeue();
                try
                {
                    if (curentDownlodingFile.ListItem != null)
                    {
                        SiteItemEntry siteItemEntry = curentDownlodingFile.ListItem.MusicTag as SiteItemEntry;
                        if (siteItemEntry != null && !string.IsNullOrEmpty(siteItemEntry.GetValue("id")))
                        {
                            ArtistItem artistItem = ArtistManager.Instance.GetArtistsById(siteItemEntry.GetValue("id"));
                            if (string.IsNullOrEmpty(curentDownlodingFile.Url) || curentDownlodingFile.Url.Contains("@") ||
                                curentDownlodingFile.Url.Contains("ytimg.com"))
                            {
                                try
                                {
                                    Artist artist = new Artist(artistItem.Name, Youtube2MP.LastFmProfile.Session);
                                    artistItem.Img_url = artist.GetImageURL(ImageSize.Huge);
                                    ArtistManager.Instance.Save(artistItem);
                                    curentDownlodingFile.Url      = artistItem.Img_url;
                                    curentDownlodingFile.FileName = Youtube2MP.GetLocalImageFileName(curentDownlodingFile.Url);
                                }
                                catch
                                {
                                }
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(curentDownlodingFile.FileName) && !File.Exists(curentDownlodingFile.FileName))
                    {
                        try
                        {
                            Client.DownloadFileAsync(new Uri(curentDownlodingFile.Url), Path.GetTempPath() + @"\station.png");
                        }
                        catch
                        {
                            downloaQueue.Enqueue(curentDownlodingFile);
                        }
                    }
                    else
                    {
                        OnDownloadTimedEvent(null, null);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                }
            }
        }
 public void OnDownloadTimedEvent(object source, ElapsedEventArgs e)
 {
     if (!Client.IsBusy && downloaQueue.Count > 0)
       {
     curentDownlodingFile = (DownloadFileObject)downloaQueue.Dequeue();
     Client.DownloadFileAsync(new Uri(curentDownlodingFile.Url), Path.GetTempPath() + @"\station.png");
       }
 }