public void InitDownloadManager()
 {
     _manager = new DownloadManager(Settings.Instance.SimultaneousDownloads);
     _manager.OnProgress += (a) =>
     {
         if (a.Status==DownloadStatus.Complete)
             Follows.Instance.AddDownload(a.Episode);
         objDownloads.RefreshObject(a);
         if (a==objDownloads.SelectedObject)
             RefreshInfo();
     };
     olvFile.AspectGetter = (x) =>
     {
         DownloadItem d = (DownloadItem) x;
         return d.DownloadInfo.FileName;
     };
     olvStatus.AspectGetter = (x) =>
     {
         DownloadItem d = (DownloadItem)x;
         return d.Status;
     };
     olvMessage.AspectGetter = (x) =>
     {
         DownloadItem d = (DownloadItem) x;
         if (!string.IsNullOrEmpty(d.DownloadError))
         {
             return d.DownloadError;
         }
         return d.DownloadInfo.Status;
     };
     objDownloads.FormatCell += (a, b) =>
     {
         if (b.ColumnIndex == olvMessage.Index)
         {
             DownloadItem d = (DownloadItem) b.Model;
             b.Item.ForeColor = !string.IsNullOrEmpty(d.DownloadError) ? Color.Red : SystemColors.ControlText;
         }
     };
     olvProgress.Renderer = new BarRenderer(0, 1000);
     olvProgress.AspectGetter = (x) =>
     {
         DownloadItem d = (DownloadItem) x;
         return (int)(d.DownloadInfo.Percent*10);
     };
        objDownloads.DragSource = new SimpleDragSource();
        objDownloads.DropSink = new DropSink(false,_manager);
 }
 public DropSink(bool t, DownloadManager mng)
     : base(t)
 {
     _manager = mng;
 }
 public DownloadItem(EpisodeWithDownloadSettings ep, string template, string path, DownloadManager manager, DownloadStatus status)
 {
     _ep                    = ep;
     Status                 = status;
     DownloadInfo           = new DownloadInfo();
     DownloadInfo.FileName  = TemplateParser.FilenameFromEpisode(ep, ep.Quality, template);
     DownloadInfo.FullPath  = Path.Combine(path, DownloadInfo.FileName);
     DownloadInfo.Quality   = ep.Quality;
     DownloadInfo.Format    = ep.Format;
     DownloadInfo.Languages = new List <string>();
     DownloadInfo.Status    = string.Empty;
     DownloadInfo.Percent   = 0;
     _template              = template;
     _path                  = path;
     Id         = Guid.NewGuid().ToString();
     _manager   = manager;
     _scheduler = TaskScheduler.FromCurrentSynchronizationContext();
 }