void junctionPointControl_JunctionPointDeleted(object sender, EventArgs e) { if (lstPoints.SelectedItem != null) { // delete this junction point NavigatorPoint selectedPoint = (NavigatorPoint)lstPoints.SelectedItem; JunctionPointItemControl itemControl = (JunctionPointItemControl)sender; if (selectedPoint.JunctionPoints.Contains(itemControl.JunctionPoint)) { selectedPoint.JunctionPoints.Remove(itemControl.JunctionPoint); } // Load selected point again LoadSelectedPoint(); } }
private void LoadSelectedPoint() { if (lstPoints.SelectedItem != null && lstPaths.SelectedItem != null) { NavigatorPoint selectedPoint = (NavigatorPoint)lstPoints.SelectedItem; if (selectedPoint != null) { // Set point control values txtPointId.Text = selectedPoint.Id; txtNextPointAngle.Text = selectedPoint.NextPointAngle.ToString(); // Load Images pointImages.Point = selectedPoint; pointImages.NavigatorPath = (NavigatorPath)lstPaths.SelectedItem; pointImages.LoadPointImages(); // Load Junction Points pnlJunctionPoints.Controls.Clear(); if (selectedPoint.JunctionPoints != null) { foreach (JunctionPoint junctionPoint in selectedPoint.JunctionPoints) { JunctionPointItemControl junctionPointControl = new JunctionPointItemControl(); junctionPointControl.JunctionPointSaved += new EventHandler(junctionPointControl_JunctionPointSaved); junctionPointControl.JunctionPointDeleted += new EventHandler(junctionPointControl_JunctionPointDeleted); junctionPointControl.JunctionPoint = junctionPoint; junctionPointControl.LoadProperties(); pnlJunctionPoints.Controls.Add(junctionPointControl); } } // Load Images in Image capture control imageCaptureControl1.NavigatorPoint = selectedPoint; imageCaptureControl1.NavigatorPath = (NavigatorPath)lstPaths.SelectedItem; imageCaptureControl1.LoadPointImages(); } } }