public void UpdateTrafficTable(report rep, Color color) { Row row = new Row(rep, color); row.BackColor = color; TrafficTable.Controls.Add(row); }
public void PopulateRow(report rep, Color color) { LastNodeLbl.Text = rep.lastAddr; LastNodeLbl.BackColor = color; NameLbl.Text = rep.addr; NameLbl.BackColor = color; NextNodeLbl.Text = rep.nextAddr; NextNodeLbl.BackColor = color; TimeStampLbl.Text = rep.timeStamp; TimeStampLbl.BackColor = color; DataLbl.Text = rep.data; DataLbl.BackColor = color; }
public void UpdateTrafficTable() { // 6 colors Color[] colorArray = { Color.Red, Color.Cyan, Color.LightGreen, Color.LightYellow, Color.Indigo, Color.Gray }; report rep = null; if (this.dbServer.newReports.Count > 0) { rep = this.dbServer.newReports.Dequeue(); } if (rep != null) { Node[] currentNodeArray = new Node[allConnectedNodes.Count]; allConnectedNodes.CopyTo(currentNodeArray); mesh.AddState(new SystemState(rep, currentNodeArray, this.states)); this.allStates.Add(new SystemState(rep, currentNodeArray, this.states)); this.states++; if (this.flag) { if (this.colorInex == 5) { this.colorInex = 0; } else { colorInex++; } this.flag = false; } if (rep.nextAddr == "Reciever") { this.flag = true; } form.UpdateTrafficTable(rep, colorArray[colorInex]); Thread.Sleep(100); } }
private void HandleReports(Socket client) { while (true) { byte[] data = new byte[1000]; string ans = ""; int size = client.Receive(data); Console.WriteLine("Recieved data: "); for (int i = 0; i < size; i++) { ans += Convert.ToChar(data[i]); } Console.WriteLine(ans); string[] detailes = ans.Split('~'); report rep = new report(detailes[0], detailes[1], detailes[2], detailes[3], detailes[4]); this.newReports.Enqueue(rep); this.allReports.Add(rep); } }
public SystemState(report rep, Node[] nodes, int index) { this.stateReport = rep; this.stateNodes = nodes; this.stateIndex = index; }
public Row(report rep, Color color) { InitializeComponent(); this.PopulateRow(rep, color); }