private void Timer_Tick(object sender, EventArgs e) { List <Node> randomized = new List <Node>(); Random random = new Random((DateTime.Now.Second % 93) % 37); while (randomized.Count != nodes.Count) { Node randNode = nodes[random.Next() % nodes.Count]; if (!randomized.Contains(randNode)) { randomized.Add(randNode); } } foreach (Node node in nodes) { if (node.Parent == null) /** this is the root*/ { SSTAlgorithm.getInstance(treeView_nodes).rootAlgo(node); } else { SSTAlgorithm.getInstance(treeView_nodes).nonRootAlgo(node); } } pnl_drawing.Refresh(); if (isStep) { timer.Stop(); } }
public static SSTAlgorithm getInstance(TreeView tree) { if (instance == null) { instance = new SSTAlgorithm(tree); } return(instance); }
private void pnl_drawing_Paint(object sender, PaintEventArgs e) { drawNodes(e.Graphics); SSTAlgorithm.getInstance(treeView_nodes).drawPath(e.Graphics); }