private void updateUI() { try { List <Node> nodeList = NodeMgr.getNodeList(); for (int index = 0; index < nodeList.Count; index++) { this.dataGridView1.Rows[index].Cells[0].Value = nodeList[index]._id; this.dataGridView1.Rows[index].Cells[1].Value = nodeList[index]._name; this.dataGridView1.Rows[index].Cells[2].Value = nodeList[index]._port; this.dataGridView1.Rows[index].Cells[3].Value = nodeList[index]._typeStr; this.dataGridView1.Rows[index].Cells[4].Value = nodeList[index]._status; if (nodeList[index]._isRunning == true) { this.dataGridView1.Rows[index].Cells[4].Style.BackColor = Color.DeepSkyBlue; } else { this.dataGridView1.Rows[index].Cells[4].Style.BackColor = Color.White; } } } catch { } }
private void initUI() { dataGridView1.Rows.Clear(); List <Node> nodeList = NodeMgr.getNodeList(); foreach (Node node in nodeList) { int index = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Cells[0].Value = node._id; this.dataGridView1.Rows[index].Cells[1].Value = node._name; this.dataGridView1.Rows[index].Cells[2].Value = node._port; this.dataGridView1.Rows[index].Cells[4].Value = node._status; } }