public AndroidDownloadOperation(AndroidDownloader downloader, BackgroundDownloadOptions options, long id)
        : base(options)
    {
        this.id = id;

        cachedStatus   = new Cached <DownloadStatus>(() => downloader.GetStatus(id));
        cachedProgress = new Cached <float>(() => downloader.GetProgress(id));
    }
Exemple #2
0
        void DownloadFiles()
        {
            var download    = new AndroidDownloader();
            var attachmemts = Attachment.DB.Rows.Where(c => c.IsDownloaded == false).ToList();

            if (attachmemts.Count > 0)
            {
                foreach (var item in attachmemts)
                {
                    download.DownloadFile($"{SessionManager.ServerAddress}/Attachments/Download/{item.ID}", item.Extension, SessionManager.ArticleFiles);
                    item.IsDownloaded = true;
                    Attachment.DB.Update(item);
                }
                download.OnFileDownloaded += OnFileDownloaded;
                SessionManager.SyncFiles   = false;
            }
        }