/// <summary>
        /// This overload of GetCrossSection launches a dialog to obtain the required parameters from the user.
        /// </summary>
        public static void GetCrossSection()
        {
            MapWinUtility.Logger.Dbg("GetCrossSection()");
            CrossSectionTypes CrossSectionType;

            Dialogs.GeoProcDialog  myDialog  = new MapWinGeoProc.Dialogs.GeoProcDialog();
            Dialogs.FileElement    grid      = myDialog.Add_FileElement(MapWinGeoProc.Dialogs.GeoProcDialog.ElementTypes.OpenGridFile);
            Dialogs.FileElement    shapefile = myDialog.Add_FileElement(MapWinGeoProc.Dialogs.GeoProcDialog.ElementTypes.OpenShapefile);
            Dialogs.FileElement    outfile   = myDialog.Add_FileElement(MapWinGeoProc.Dialogs.GeoProcDialog.ElementTypes.SaveShapefile);
            Dialogs.BooleanElement points    = myDialog.Add_BooleanElement();
            grid.Caption             = "Elevation Grid File name";
            shapefile.Caption        = "Cross-Section Input Polyline Shapefile";
            outfile.Caption          = "Cross-Section Output Shapefile name";
            points.Caption           = "Output cross sections as points";
            myDialog.DialogHelpText  = "This function will use a vector polyline shapefile to determine elevations as cross sections.";
            myDialog.DialogHelpTitle = "Get Cross Section";
            try
            {
                //ResourceManager rm = new ResourceManager("clsHydrology.CrossSection", Assembly.GetExecutingAssembly());
                //System.Drawing.Bitmap b = (System.Drawing.Bitmap)rm.GetObject("CrossSectionHelp");

                //myDialog.DialogHelpImage = (System.Drawing.Image)b;
                //myDialog.HelpImage = (System.Drawing.Image)b;
            }
            catch (Exception ex)
            {
                MapWinUtility.Logger.Message(ex.Message, "Exception Thrown", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, System.Windows.Forms.DialogResult.OK);
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            myDialog.ShowDialog();
            if (myDialog.DialogResult != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            CrossSectionType = CrossSectionTypes.PolyLineWithZ;
            if (points.Value == true)
            {
                CrossSectionType = CrossSectionTypes.PointsWithZAndElevField;
            }
            GetCrossSection(grid.Filename, shapefile.Filename, outfile.Filename, CrossSectionType);
            MapWinUtility.Logger.Dbg("Finished GetCrossSection");
        }
 private void cmdOK_Click(object sender, EventArgs e)
 {
     for (int I = 0; I < Elements.Count; I++)
     {
         Type elType = Elements[I].GetType();
         if (elType == typeof(FileElement))
         {
             FileElement fe = Elements[I] as FileElement;
             if (fe.Halt == true)
             {
                 string caption = fe.Caption;
                 string text;
                 text = "The value you entered for " + caption + " has the following error:\n" +
                        fe.LightMessage + "\n";
                 MessageBox.Show(text, "Some Parameters are invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             }
         }
         if (elType == typeof(LayerFileElement))
         {
             LayerFileElement fe = Elements[I] as LayerFileElement;
             if (fe.Halt == true)
             {
                 string caption = fe.Caption;
                 string text;
                 text = "The value you entered for " + caption + " has the following error:\n" +
                        fe.LightMessage + "\n";
                 MessageBox.Show(text, "Some Parameters are invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             }
         }
         else if (elType == typeof(TextElement))
         {
             TextElement fe = Elements[I] as TextElement;
             if (fe.Halt == true)
             {
                 string caption = fe.Caption;
                 string text;
                 text = "The value you entered for " + caption + " has the following error:\n" +
                        fe.LightMessage + "\n";
                 MessageBox.Show(text, "Some Parameters are invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             }
         }
         else if (elType == typeof(ComboBoxElement))
         {
             ComboBoxElement fe = Elements[I] as ComboBoxElement;
             if (fe.Halt == true)
             {
                 string caption = fe.Caption;
                 string text;
                 text = "The value you entered for " + caption + " has the following error:\n" +
                        fe.LightMessage + "\n";
                 MessageBox.Show(text, "Some Parameters are invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             }
         }
     }
     this.DialogResult = DialogResult.OK;
     if (!this.Modal)
     {
         this.Hide();
     }
 }
        /// <summary>
        /// Adds a new FileElement to the dialog and to the Elements arraylist.
        /// </summary>
        /// <param name="ElementType">An ElementTypes enumeration specifying what sort of files the project will use.</param>
        /// <returns></returns>
        public FileElement Add_FileElement(ElementTypes ElementType)
        {
            FileElement MyFileElement = new FileElement();

            if (ElementType == ElementTypes.OpenFile || ElementType == ElementTypes.OpenGridFile ||
                ElementType == ElementTypes.OpenImageFile || ElementType == ElementTypes.OpenShapefile)
            {
                MyFileElement.FileAccess = FileElement.FileAccessType.Open;
                MyFileElement.HelpImage  = MyFileElement.DefaultImage;
            }
            else
            {
                MyFileElement.FileAccess = FileElement.FileAccessType.Save;
                MyFileElement.HelpImage  = MyFileElement.AlternateImage;
            }
            switch (ElementType)
            {
            case ElementTypes.OpenFile:
                MyFileElement.FileType = FileElement.FileTypes.All;
                MyFileElement.Caption  = "Input Filename";
                MyFileElement.HelpText = "Retrieves a filename for an unspecified file format either through the textbox or through the browse button.  A green light indicates that the file exists.  A red light indicates that the file does not exist.";
                break;

            case ElementTypes.OpenGridFile:
                MyFileElement.FileType = FileElement.FileTypes.Grid;
                MyFileElement.Caption  = "Input Grid Filename";
                MyFileElement.HelpText = "Retrieves a filename for a grid file format either through the textbox or through the browse button.  A green light indicates that the file exists.  A red light indicates that the file does not exist.";
                break;

            case ElementTypes.OpenImageFile:
                MyFileElement.FileType = FileElement.FileTypes.Image;
                MyFileElement.Caption  = "Input Image Filename";
                MyFileElement.HelpText = "Retrieves a filename for an image file format either through the textbox or through the browse button.  A green light indicates that the file exists.  A red light indicates that the file does not exist.";
                break;

            case ElementTypes.OpenShapefile:
                MyFileElement.FileType = FileElement.FileTypes.Shapefile;
                MyFileElement.Caption  = "Input Shapefile Filename";
                MyFileElement.HelpText = "Retrieves a filename for a shapefile either through the textbox or through the browse button.  A green light indicates that the file exists.  A red light indicates that the file does not exist.";
                break;

            case ElementTypes.SaveFile:
                MyFileElement.FileType = FileElement.FileTypes.All;
                MyFileElement.Caption  = "Output Filename";
                MyFileElement.HelpText = "Retrieves a filename for an unspecified file format either through the textbox or through the browse button.  A green light indicates that a file of that name does not exist yet or permission to overwrite was given through the browse dialog.  A red light indicates that a file with that name exists.";
                break;

            case ElementTypes.SaveImageFile:
                MyFileElement.FileType = FileElement.FileTypes.Image;
                MyFileElement.Caption  = "Output Image Filename";
                MyFileElement.HelpText = "Retrieves a filename for an image file format either through the textbox or through the browse button.  A green light indicates that a file of that name does not exist yet or permission to overwrite was given through the browse dialog.  A red light indicates that a file with that name exists.";
                break;

            case ElementTypes.SaveGridFile:
                MyFileElement.FileType = FileElement.FileTypes.Grid;
                MyFileElement.Caption  = "Output Grid Filename";
                MyFileElement.HelpText = "Retrieves a filename for a grid file format either through the textbox or through the browse button.  A green light indicates that a file of that name does not exist yet or permission to overwrite was given through the browse dialog.  A red light indicates that a file with that name exists.";
                break;

            case ElementTypes.SaveShapefile:
                MyFileElement.FileType = FileElement.FileTypes.Shapefile;
                MyFileElement.Caption  = "Output Shapefile Filename";
                MyFileElement.HelpText = "Retrieves a filename for a shapefile either through the textbox or through the browse button.  A green light indicates that a file of that name does not exist yet or permission to overwrite was given through the browse dialog.  A red light indicates that a file with that name exists.";
                break;
            }
            Elements.Add(MyFileElement);
            MyFileElement.ResizeGripVisible = false;
            MyFileElement.HaltOnEmpty       = true;
            MyFileElement.HaltOnError       = true;
            MyFileElement.HelpButtonVisible = true;
            MyFileElement.LightVisible      = true;
            MyFileElement.Location          = new System.Drawing.Point(3, 10 + ((Elements.Count - 1) * 55));
            MyFileElement.Name = "Element" + Elements.Count;
            int myWidth = this.panelElementContainer.Width - MyFileElement.Left - 10;

            MyFileElement.Anchor              = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right | System.Windows.Forms.AnchorStyles.Top)));
            MyFileElement.Size                = new System.Drawing.Size(myWidth, 45);
            MyFileElement.Status              = FileElement.LightStatus.Empty;
            MyFileElement.HelpButtonPressed  += new FileElement.HelpButtonHandler(Element_HelpButtonPressed);
            MyFileElement.ResizeStarted      += new FileElement.ResizeStartedHandler(Element_ResizeStarted);
            MyFileElement.ResizeEnded        += new FileElement.ResizeEndedHandler(Element_ResizeEnded);
            MyFileElement.HelpContextChanged += new FileElement.HelpButtonHandler(MyFileElement_HelpContextChanged);
            MyFileElement.Clicked            += new EventHandler(panelElementContainer_Click);
            this.panelElementContainer.Controls.Add(MyFileElement);
            return(MyFileElement);
        }