public DataServicePackageRepository(IHttpClient client, PackageDownloader packageDownloader)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }
            if (packageDownloader == null)
            {
                throw new ArgumentNullException("packageDownloader");
            }

            _httpClient = client;
            _httpClient.AcceptCompression = true;

            _packageDownloader = packageDownloader;

            if (EnvironmentUtility.RunningFromCommandLine || EnvironmentUtility.IsMonoRuntime)
            {
                _packageDownloader.SendingRequest += OnPackageDownloaderSendingRequest;
            }
            else
            {
                // weak event pattern
                SendingRequestEventManager.AddListener(_packageDownloader, this);
            }
        }
Exemple #2
0
 public DataServicePackageRepository(IHttpClient client, NuGet.PackageDownloader packageDownloader)
 {
     if (client == null)
     {
         throw new ArgumentNullException("client");
     }
     if (packageDownloader == null)
     {
         throw new ArgumentNullException("packageDownloader");
     }
     this._httpClient = client;
     this._httpClient.AcceptCompression = true;
     this._packageDownloader            = packageDownloader;
     if (!EnvironmentUtility.RunningFromCommandLine && !EnvironmentUtility.IsMonoRuntime)
     {
         SendingRequestEventManager.AddListener(this._packageDownloader, this);
     }
     else
     {
         this._packageDownloader.SendingRequest += new EventHandler <WebRequestEventArgs>(this.OnPackageDownloaderSendingRequest);
     }
 }