public SearchViewModel(IDownloaderFactory downloaderFactory, INewObject newObject)
 {
     _downloaderFactory = downloaderFactory;
     _newObject = newObject;
     Console.WriteLine(downloaderFactory.Create().GetHashCode());
     Console.WriteLine(downloaderFactory.Create().GetHashCode());
 }
        /// <summary>
        /// Récupération des dernières VDM.
        /// </summary>
        /// <returns>Collection de VDM</returns>
        public VieDeMerdeCollection GetLastVieDeMerdes()
        {
            VieDeMerdeCollection vdms = new VieDeMerdeCollection();
            List <VieDeMerde>    list = new List <VieDeMerde>();

            using (IDownloader downloader = _downloaderFactory.Create())
            {
                string       html = downloader.DownloadString(_url);
                HtmlDocument doc  = new HtmlDocument();
                doc.LoadHtml(html);

                HtmlNodeCollection articles = doc.DocumentNode.SelectNodes("//article[@class='article-panel']");

                foreach (HtmlNode article in articles)
                {
                    VieDeMerde vdm = new VieDeMerde();
                    vdm.Titre   = ExtractTitre(article);
                    vdm.Auteur  = ExtractAuteur(article);
                    vdm.Contenu = ExtractContent(article);
                    list.Add(vdm);
                }
            }

            vdms.VieDemerde = list.ToArray();
            return(vdms);
        }
 private void Download(object sender, DoWorkEventArgs e)
 {
     _factory.Create().Download(item);
 }
 public IDownloader Create(TKey key)
 {
     return(new AccessLimitedDownloader(targetDownloader: _downloaderFactory.Create(key),
                                        pageLoadTimout: _pageLoadTimout));
 }
 public IDownloader Create(TKey key)
 {
     return(_downloaders.GetOrAdd(key, guid => _downloaderFactory.Create(key)));
 }