private void WorkerAttemptConnection(object sender, DoWorkEventArgs e)
{
var values = (dynamic) e.Argument;
var connectionNode = (ConnectionNode)values.connectionNode;
var rememberText = values.rememberText;
var connectionStatus = BlockStudioProjectService.BlockStudioProject.Connection.GetConnectionProperties();
if (connectionStatus == ConnectionStatus.CouldNotConnect)
{
BeginInvoke((MethodInvoker)delegate
{
var result = MessageBoxEx.Show(this, string.Format("Could not connect, is Ethereum running on port {0}?", BlockStudioProjectService.BlockStudioProject.Connection.RpcPort), "Block Studio", MessageBoxButtons.RetryCancel,
MessageBoxIcon.Error);
if (result == DialogResult.Retry)
{
AttemptConnection(connectionNode);
}
});
}
else if (connectionStatus == ConnectionStatus.ConnectedButPersonalNotSuppored)
{
BeginInvoke((MethodInvoker)delegate
{
MessageBoxEx.Show(this, string.Format(@"Connected but account creation not supported.{0}{0}Run geth with --rpcapi ""eth,web3,personal"" parameter", Environment.NewLine), "Block Studio", MessageBoxButtons.OK, MessageBoxIcon.Warning);
});
}
else
{
BeginInvoke((MethodInvoker)delegate
{
TreeNodeManager.ExpandConnectionProperties(connectionNode);
if (!connectionNode.HasConnected)
{
connectionNode.HasConnected = true;
connectionPanel1.BindControls();
}
});
}
BeginInvoke((MethodInvoker)delegate
{
connectionNode.Text = rememberText;
connectionNode.ForeColor = Color.Black;
connectionNode.ImageIndex = 1;
});
}