private void button_simulate_Click(object sender, EventArgs e) { CityLogistic.BFS(comboBox1.SelectedIndex); foreach (String a in CityLogistic.infected) { Console.WriteLine(a); } foreach (KeyValuePair <String, int> a in City.cityCollection) { if (CityLogistic.infected.Contains(a.Key)) { graf.FindNode(a.Key).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Red; } else { graf.FindNode(a.Key).Attr.FillColor = Microsoft.Msagl.Drawing.Color.White; } } this.Invoke((MethodInvoker) delegate { Microsoft.Msagl.Drawing.Graph tmp = gViewer.Graph; gViewer.Graph = null; gViewer.Graph = tmp; // workarround to force updating }); }
private void next_to_hasil_Click(object sender, EventArgs e) { panel_home.Visible = false; panel_file.Visible = false; panel_hasil.Visible = true; City.importCity(label9.Text); CityLogistic.ImportLogistic(label8.Text); foreach (KeyValuePair <String, List <String> > a in CityLogistic.cityEdge) { Console.WriteLine(a.Key); foreach (String b in a.Value) { Console.WriteLine("-" + b); graf.AddEdge(a.Key, b); } } gViewer.Graph = graf; gViewer.Size = new Size(600, 500); this.panel_msagl.Controls.Add(gViewer); }