private void btnEdge_Click(object sender, EventArgs e) { if (listBox1.SelectedItem == null || listBox2.SelectedItem == null) return; if (listBox1.SelectedItem != listBox2.SelectedItem && !string.IsNullOrEmpty(txtEdge.Text.Trim())) { SampleEdge newEdge = new SampleEdge(txtEdge.Text, (SampleNode)listBox1.SelectedItem, (SampleNode)listBox2.SelectedItem); myGraph.AddEdge(newEdge); } }
public void AddEdge(SampleEdge edgeToAdd) { _MyEdges.Add(edgeToAdd); }
public void AddEdge(SampleEdge edgeToAdd) { _MyEdges.Add(edgeToAdd); edgeToAdd.Source.AddEdge(edgeToAdd); }