Ejemplo n.º 1
0
        public void AddDownloadTask(DownloadInfo info)
        {
            var download = HttpDownload.GetTaskByInfo(info);

            download.DownloadStateChangedEvent    += Download_DownloadStateChangedEvent;
            download.DownloadProgressChangedEvent += Download_DownloadProgressChangedEvent;



            //if (downloadingPageStateChanged != null)
            //{
            //    download.DownloadStateChangedEvent += downloadingPageStateChanged;

            //}
            //if (downloadingPageProgressChanged != null)
            //{
            //    download.DownloadProgressChangedEvent += downloadingPageProgressChanged;
            //}

            _downloadingTasks.Add(download);

            download.Start();


            TaskCollectionChanged?.Invoke(download);
        }
Ejemplo n.º 2
0
        public NextResult CreateData(DownloadingFileData info, DownloadResult result)
        {
            try
            {
                var httpInfo = HttpDownload.CreateTaskInfo(result.Urls, info.DownloadPath);

                info.Info = httpInfo;
                info.Save();


                return(new NextResult(httpInfo, 0, string.Empty));
            }
            catch (Exception ex)
            {
                return(null);
            }
        }