/// <summary> /// Handle the transaction we're mining having it's properties updated. /// </summary> /// <param name="sender"> /// The event sender. /// </param> /// <param name="e"> /// The event arguments. /// </param> private void OnTransactionToMinePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { // Only process changes indicating completion EnqueuedTransaction transaction = sender as EnqueuedTransaction; if (transaction == null || TransactionToMine == null) { return; } if (!transaction.Completed) { return; } // Clear out the transaction to mine TransactionToMine = null; SiftDialogViewModel viewModel = _miningTransactionDialogViewModel; // Display a message accordingly viewModel.IsReturnButtonVisible = true; if (transaction.WasSuccessful) { Logger.ApplicationInstance.Info("Purchase of SIFT added to block " + transaction.Receipt.BlockNumber.Value.ToString() + " for " + transaction.Receipt.TransactionHash + " at index " + transaction.Receipt.TransactionIndex.Value.ToString()); viewModel.Title = "SIFT Purchase Successful"; viewModel.Message = "Congratulations! Your transaction for the purchase of SIFT has gone onto the Ethereum network. Your new balance will be updated shortly and will be reflected in your Ethereum wallet."; viewModel.IsSiftLogoVisible = true; viewModel.IsEthereumAnimatedLogoVisible = false; } else { Logger.ApplicationInstance.Error("TransactionToMine failed with message. " + transaction.ErrorDetails); viewModel.Title = "Problem Purchasing SIFT"; viewModel.Message = "There was a problem processing your transaction for SIFT. " + transaction.ErrorDetails; } }
/// <summary> /// Enqueue a transaction that has been sent into the mining queue to get a receipt for it. /// </summary> /// <param name="transactionHash"> /// The hash of the transaction. /// </param> /// <returns> /// An object to track the state of the mining. /// </returns> public EnqueuedTransaction EnqueueTransactionPendingReceipt(string transactionHash) { EnqueuedTransaction transaction = new EnqueuedTransaction(transactionHash); lock (_miningQueueLocker) _miningQueue.Add(transaction); return(transaction); }