/// <summary> /// Inserts a download /// </summary> /// <param name="download">Download</param> public virtual void InsertDownload(Download download) { if (download == null) { throw new ArgumentNullException("download"); } _downloadRepository.Insert(download); //_eventPubisher.EntityInserted(download); }
public async void QueueUrl(QueueUrl qurl) { Console.WriteLine("[Downloadanager] QueueUrl"); Console.WriteLine("[Downloadanager] QueueUrl Url : {0}", qurl.Url); Console.WriteLine("[Downloadanager] QueueUrl Description : {0}", qurl.Description); string url = qurl.Url; string description = qurl.Description; Download result = null; bool exists = _repo.TryByUrl(url, out result); if (exists) { await _bus.SendAsync <NotifyProgress> (new NotifyProgress { Url = result.Url, Download = result }); await _bus.SendAsync <AlreadyQueued> (new AlreadyQueued { Url = url }); return; } var insert = new Bo.Download { State = Bo.State.Waiting, Url = url, ErrorDescription = description, Written = 0, Total = 0 }; _repo.Insert(insert); await _bus.SendAsync <CheckFreeSlot> (new CheckFreeSlot()); await _bus.SendAsync <NotifyProgress> (new NotifyProgress { Url = insert.Url, Download = insert }); return; }