private void btnDraw_Click(object sender, RoutedEventArgs e) { switch (cbFunction.SelectedItem.ToString()) { case "Spectral Graph for GB-S3VDD": //Draw Visual Spectral Graph for GB-S3VDD //Clear old Edge for (int i = 0; i < drawingPad.Children.Count; ++i) { string obj = drawingPad.Children[i].ToString(); if (obj.IndexOf("Line") != -1) { drawingPad.Children.RemoveAt(i); i--; } } dataset = new Dataset(lstPoint.ToArray()); graph = new GraphBase(dataset, double.Parse(txtXichma.Text), int.Parse(txtK.Text)); graph.myCanvas = drawingPad; graph.DrawSG_for_GBS3VDD(); tbStatus.Text = "Visual Spectral Graph for GB-S3VDD (with k = " + txtK.Text + " & σ = " + txtXichma.Text + ") completed !"; break; case "Spectral Graph": //Draw Visual spectral graph //Clear old Edge for (int i = 0; i < drawingPad.Children.Count; ++i) { string obj = drawingPad.Children[i].ToString(); if (obj.IndexOf("Line") != -1) { drawingPad.Children.RemoveAt(i); i--; } } dataset = new Dataset(lstPoint.ToArray()); graph = new GraphBase(dataset, double.Parse(txtXichma.Text), int.Parse(txtK.Text)); graph.myCanvas = drawingPad; graph.DrawVSG(); tbStatus.Text = "Visual Spectral Graph (with k = " + txtK.Text + " & σ = " + txtXichma.Text + ") completed !"; break; } }