private void SendAction(Action <NodeActionDispatcher, BlockchainNode> action) { if (dataGridViewNodes.SelectedRows.Count == 0) { return; } foreach (DataGridViewRow row in dataGridViewNodes.SelectedRows) { BlockchainNode node = (BlockchainNode)row.Cells["Node"].Value; var agent = clientConnectionManager.GetAgent(node.NodeConfig.Agent); NodeActionDispatcher dispatcher = (NodeActionDispatcher)agent.Dispatchers[MessageType.ActionRequest]; action.Invoke(dispatcher, node); } }
private void RemoveResourceForSelectedNodes(NodeResourceType resourceType) { if (dataGridViewNodes.SelectedRows.Count == 0) { return; } foreach (DataGridViewRow row in dataGridViewNodes.SelectedRows) { BlockchainNode node = (BlockchainNode)row.Cells["Node"].Value; var agent = clientConnectionManager.GetAgent(node.NodeConfig.Agent); NodeActionDispatcher dispatcher = (NodeActionDispatcher)agent.Dispatchers[MessageType.ActionRequest]; dispatcher.RemoveResource(node, resourceType); } }
private void RemoveResourceForSelectedNodes(NodeResourceType resourceType) { if (dataGridViewNodes.SelectedRows.Count == 0) { return; } foreach (DataGridViewRow row in dataGridViewNodes.SelectedRows) { BlockchainNode node = (BlockchainNode)row.Cells["Node"].Value; var agent = clientConnectionManager.GetAgent(node.NodeConfig.Agent); NodeActionDispatcher dispatcher = (NodeActionDispatcher)agent.Dispatchers[MessageType.ActionRequest]; dispatcher.RemoveResource(node, resourceType, response => { if (!response.IsSuccess) { MessageBox.Show(response.MessageHeader, "Action failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }); } }