BlockStudio.Ethereum.Filter.EthereumFilterManager.WorkerAttemptConnection C# (CSharp) Method

WorkerAttemptConnection() private method

Queries the filter to find the new transaction
private WorkerAttemptConnection ( object sender, DoWorkEventArgs e ) : void
sender object
e System.ComponentModel.DoWorkEventArgs
return void
        private void WorkerAttemptConnection(object sender, DoWorkEventArgs e)
        {
            while (true)
            {
                var blockTxHashes = BlockStudioProjectService.BlockStudioProject.Connection.EthereumService.GetBlockFilterChanges(_txHashFilterId);
                if (blockTxHashes.Any())
                {
                    // a new block has arrived
                    foreach (var blockTxHash in blockTxHashes)
                    {
                        var block = BlockStudioProjectService.BlockStudioProject.Connection.EthereumService.GetBlockByHash(blockTxHash,true);

                        var tx = block.TransactionsFull.FirstOrDefault(x => x.Hash == _newTxHash);

                        // the tx is now on the blockchain
                        if (tx != null)
                        {
                            BlockStudioProjectService.TransactionReceipt = BlockStudioProjectService.BlockStudioProject.Connection.EthereumService.GetTransactionReceipt(tx.Hash);
                            _consoleTextBox.WriteConsonsoleMessage("Contract mined!: {0}", BlockStudioProjectService.TransactionReceipt.ContractAddress);

                        }
                    }
                }

                Thread.Sleep(500);
            }
        }