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 RacePlotter {
00012 public partial class PointSelector : Form {
00013
00014 public delegate void pointSelectEventHandler();
00015 public event pointSelectEventHandler pointSelectEvent;
00016 public event pointSelectEventHandler pointSelectCancelEvent;
00017 List<UtmPoint> _points;
00018
00019 public PointSelector(List<UtmPoint> pts) {
00020 InitializeComponent();
00021 _points = pts;
00022 foreach (UtmPoint p in _points)
00023 waypointListBox.Items.Add("zone:" + p.Zone + ", x:" + p.Point.X
00024 + ", y:" + p.Point.Y + ", note:" + p.Note + ", handle:" + p.Handle);
00025 waypointListBox.SelectedIndex = 0;
00026 }
00027
00028 private void selectButton_Click(object sender, EventArgs e) {
00029 selectPoint();
00030 }
00031
00032 public UtmPoint getSelectedPoint() {
00033 return _points[waypointListBox.SelectedIndex];
00034 }
00035
00036
00037
00038
00039
00040 private void canceBlutton_Click(object sender, EventArgs e) {
00041 if (pointSelectCancelEvent != null)
00042 pointSelectCancelEvent.Invoke();
00043 this.Close();
00044 }
00045
00046 private void waypointListBox_DoubleClick(object sender, EventArgs e) {
00047 selectPoint();
00048 }
00049
00050 private void selectPoint() {
00051 if (pointSelectEvent != null)
00052 pointSelectEvent.Invoke();
00053 this.Close();
00054 }
00055
00056 }
00057 }