private void createFeature_Click(object sender, EventArgs e)
        {
            if (elements.Items.Count == 0)
                MessageBox.Show("Must create elements.");
            else
            {
                DynamicForm f = new DynamicForm("Configure feature...", DynamicForm.CloseButtons.OkCancel);
                f.AddTextBox("Feature name:", null, 50, "name");
                if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string name = f.GetValue<string>("name").Trim();
                    if (name == "")
                        MessageBox.Show("Invalid name:  must not be blank.");
                    else
                    {
                        Shapefile shapefile = null;
                        try
                        {
                            shapefile = Shapefile.Create(name, (elements.Items[0] as Geometry).SRID, Shapefile.ShapefileType.Feature);
                            ShapefileGeometry.Create(shapefile, elements.Items.Cast<Geometry>().Select(g => new Tuple<Geometry, DateTime>(g, DateTime.MinValue)).ToList());
                            MessageBox.Show("Shapefile \"" + name + "\" created.");
                            elements.Items.Clear();
                            points.Items.Clear();
                        }
                        catch (Exception ex)
                        {
                            Console.Out.WriteLine("Failed to create shapefile:  " + ex.Message);

                            try { shapefile.Delete(); }
                            catch (Exception ex2) { Console.Out.WriteLine("Failed to delete failed shapefile:  " + ex2.Message); }
                        }
                    }
                }
            }
        }
        private void createFeature_Click(object sender, EventArgs e)
        {
            if (elements.Items.Count == 0)
            {
                MessageBox.Show("Must create elements.");
            }
            else
            {
                DynamicForm f = new DynamicForm("Configure feature...", DynamicForm.CloseButtons.OkCancel);
                f.AddTextBox("Feature name:", null, 50, "name");
                if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string name = f.GetValue <string>("name").Trim();
                    if (name == "")
                    {
                        MessageBox.Show("Invalid name:  must not be blank.");
                    }
                    else
                    {
                        Shapefile shapefile = null;
                        try
                        {
                            shapefile = Shapefile.Create(name, (elements.Items[0] as Geometry).SRID, Shapefile.ShapefileType.Feature);
                            ShapefileGeometry.Create(shapefile, elements.Items.Cast <Geometry>().Select(g => new Tuple <Geometry, DateTime>(g, DateTime.MinValue)).ToList());
                            MessageBox.Show("Shapefile \"" + name + "\" created.");
                            elements.Items.Clear();
                            points.Items.Clear();
                        }
                        catch (Exception ex)
                        {
                            Console.Out.WriteLine("Failed to create shapefile:  " + ex.Message);

                            try { shapefile.Delete(); }
                            catch (Exception ex2) { Console.Out.WriteLine("Failed to delete failed shapefile:  " + ex2.Message); }
                        }
                    }
                }
            }
        }