#pragma warning restore

        public async Task <DownloadItem> AddDownloadingImageAsync(DownloadItem item)
        {
            if (DownloadingImages == null)
            {
                DownloadingImages = new ObservableCollection <DownloadItem>();
            }

            var existItem = DownloadingImages.Where(s =>
            {
                return(s.ImageItem.Image.ID == item.ImageItem.Image.ID);
            }).FirstOrDefault();

            if (existItem != null)
            {
                if (existItem.DisplayIndex == (int)DisplayMenu.Retry)
                {
                    return(existItem);
                }
            }

            DownloadingImages.Insert(0, item);
            item.OnMenuStatusChanged += Item_OnMenuStatusChanged;
            var list = await BackgroundDownloader.GetCurrentDownloadsAsync();

            return(item);
        }
 private void DownloadItemsInternal(Func <DownloadItem, bool> canDownload)
 {
     for (int i = 0; i < DownloadingImages.Count; i++)
     {
         var item = DownloadingImages[i];
         if (canDownload(item))
         {
             DownloadingImages.Remove(item);
             i--;
         }
     }
 }
 public void DeleteDownload(DownloadItem item)
 {
     DownloadingImages.Remove(item);
 }