public AsyncTask DownloadAsync(DownloadParameter downloadParam,
                                       AsyncCallbacks <DownloadResult> asyncCallbacks = null)
        {
            CheckParameter(downloadParam != null, "downloadParam is required");

            var asyncTask = new AsyncTask();

            AsyncUtils.ProcessFirstItem(DoCompleteDownload(downloadParam), asyncCallbacks, asyncTask);

            return(asyncTask);
        }
 private IObservable <DownloadResult> DoCompleteDownload(DownloadParameter downloadParam)
 {
     try
     {
         var result = BlockchainTransactionService.GetTransferTransaction(downloadParam.TransactionHash)
                      .Select(transferTransaction => RetrieveProximaxMessagePayloadService.GetMessagePayload(
                                  transferTransaction,
                                  downloadParam.AccountPrivateKey))
                      .Select(messagePayload => CreateCompleteDownloadResult(messagePayload,
                                                                             () => GetDataByteStream(messagePayload, null, downloadParam.PrivacyStrategy,
                                                                                                     downloadParam.ValidateDigest, null).Wait(), downloadParam.TransactionHash)).Wait();
         return(Observable.Return(result));
     }
     catch (Exception ex)
     {
         return(Observable.Throw <DownloadResult>(new DownloadFailureException("Download failed.", ex)));
     }
 }
        public DownloadResult Download(DownloadParameter downloadParam)
        {
            CheckParameter(downloadParam != null, "downloadParam is required");

            return(DoCompleteDownload(downloadParam).Wait());
        }