Ejemplo n.º 1
0
 private IObservable <string> CreateAndAnnounceTransaction(UploadParameter uploadParam,
                                                           ProximaxMessagePayloadModel messagePayload)
 {
     return(BlockchainTransactionService.CreateAndAnnounceTransaction(
                messagePayload, uploadParam.SignerPrivateKey, uploadParam.RecipientPublicKey,
                uploadParam.RecipientAddress,
                uploadParam.TransactionDeadline, uploadParam.TransactionMosaics,
                uploadParam.UseBlockchainSecureMessage));
 }
Ejemplo n.º 2
0
        public AsyncTask UploadAsync(UploadParameter uploadParam, AsyncCallbacks <UploadResult> asyncCallbacks)
        {
            CheckParameter(uploadParam != null, "uploadParam is required");

            var asyncTask = new AsyncTask();

            AsyncUtils.ProcessFirstItem(DoUpload(uploadParam), asyncCallbacks, asyncTask);

            return(asyncTask);
        }
Ejemplo n.º 3
0
 private IObservable <UploadResult> DoUpload(UploadParameter uploadParam)
 {
     try
     {
         var uploadResult = CreateProximaxDataService.CreateData(uploadParam).SelectMany(uploadedData =>
                                                                                         CreateProximaxMessagePayloadService.CreateMessagePayload(uploadParam, uploadedData)
                                                                                         .SelectMany(messagePayload =>
                                                                                                     CreateAndAnnounceTransaction(uploadParam, messagePayload)
                                                                                                     .Select(transactionHash =>
                                                                                                             CreateUploadResult(messagePayload, transactionHash)))).Wait();
         return(Observable.Return(uploadResult));
     }
     catch (Exception ex)
     {
         return(Observable.Throw <UploadResult>(new UploadFailureException("Upload failed.", ex)));
     }
 }
Ejemplo n.º 4
0
        public UploadResult Upload(UploadParameter uploadParam)
        {
            CheckParameter(uploadParam != null, "uploadParam is required");

            return(DoUpload(uploadParam).Wait());
        }