Example #1
0
        public void AcquireAsync(Uri ressource, RessourceHandler <T> handler, CallbackHandler <T> callback, DownloadInfo userArgs)
        {
            _info = userArgs;

            if (!string.IsNullOrEmpty(_info.Url.AbsolutePath))
            {
                DownloadClient <T> webDL = new DownloadClient <T>();
                webDL.DownloadAsync(_info, handler, callback);
                return;
            }

            throw new UriFormatException("URL cannot be null or empty");
        }
Example #2
0
        public T Acquire(Uri ressource, DownloadInfo userArgs, RessourceHandler <T> handler)
        {
            _info = userArgs;

            if (!string.IsNullOrEmpty(_info.Url.AbsolutePath))
            {
                DownloadClient <T> webDL          = new DownloadClient <T>();
                byte[]             downloadedData = webDL.Download(_info);
                return(handler(downloadedData));
            }

            throw new UriFormatException("URL connot be null or empty");
        }