00001 using System; 00002 using System.Collections.Generic; 00003 using System.ComponentModel; 00004 using System.Data; 00005 using System.Drawing; 00006 using System.Linq; 00007 using System.Text; 00008 using System.Windows.Forms; 00009 using UtmConvert; 00010 00011 namespace system_controller { 00012 public partial class PointPickerForm : Form { 00013 00014 public delegate void waypointSelectEventHandler(); 00015 public event waypointSelectEventHandler waypointSelectEvent; 00016 public event waypointSelectEventHandler waypointSelectCancelEvent; 00017 List<UtmPoint> _pointSet; 00018 00019 public PointPickerForm(List<UtmPointSet> pts) { 00020 InitializeComponent(); 00021 _pointSet = new List<UtmPoint>(); 00022 _pointSet = pts[0].Points; 00023 foreach (UtmPoint p in _pointSet) 00024 waypointListBox.Items.Add("zone:" + p.Zone + ", x:" + p.Point.X 00025 + ", y:" + p.Point.Y + ", note:" + p.Note + ", handle:" + p.Handle); 00026 waypointListBox.SelectedIndex = 0; 00027 } 00028 00029 private void selectButton_Click(object sender, EventArgs e) { 00030 selectWaypoint(); 00031 } 00032 00033 public UtmPoint getSelectedPoint() { 00034 return _pointSet[waypointListBox.SelectedIndex]; 00035 } 00036 00037 private void canceBlutton_Click(object sender, EventArgs e) { 00038 if (waypointSelectCancelEvent != null) 00039 waypointSelectCancelEvent.Invoke(); 00040 this.Close(); 00041 } 00042 00043 private void waypointListBox_DoubleClick(object sender, EventArgs e) { 00044 selectWaypoint(); 00045 } 00046 00047 private void selectWaypoint() { 00048 if (waypointSelectEvent != null) 00049 waypointSelectEvent.Invoke(); 00050 this.Close(); 00051 } 00052 00053 } 00054 }