//REO 10/2008
        private void fileLoadButton_Click(object sender, EventArgs e)
        {
            try
            {
                // Create an instance of StreamReader to read from a file.
                // The using statement also closes the StreamReader.
                using (StreamReader sr = new StreamReader(filePathTextBox.Text))
                {
                    //to hold temporary X and Y values
                    Waveform tempwaveform = new Waveform();
                    //to parse each line in the file at either space or comma seperator
                    //trimming each line of white space at the beginning and end
                    DataStructures.UtilityClasses.WaveformParser p = new  DataStructures.UtilityClasses.WaveformParser(sr, @"[,\s]\s*", delegate(string s) { return(s.Trim()); });

                    double[] values;
                    while ((values = p.ReadFloats()) != null)
                    {
                        //there should be two values, otherwise the file is formated wrong
                        if (values.Length != 2)
                        {
                            throw new System.ApplicationException("File should have two comma or tab separated numbers per line");
                        }

                        tempwaveform.XValues.Add(new DimensionedParameter(Units.s, values[0]));
                        tempwaveform.YValues.Add(new DimensionedParameter(new Units(currentWaveform.YUnits, Units.Multiplier.unity), values[1]));
                    }

                    currentWaveform.XValues          = tempwaveform.XValues;
                    currentWaveform.YValues          = tempwaveform.YValues;
                    currentWaveform.DataFileName     = filePathTextBox.Text;
                    currentWaveform.WaveformDuration = (currentWaveform.XValues.Count > 0)
                        ? currentWaveform.XValues[currentWaveform.XValues.Count - 1] : currentWaveform.WaveformDuration;
                    layoutNewWaveform();

                    updateGraph(this, null);
                }
            }
            catch (Exception ex)
            {
                // Let the user know what went wrong.
                MessageBox.Show("The file could not be read:\n" + ex.Message);
            }
        }
        //REO 10/2008
        private void fileLoadButton_Click(object sender, EventArgs e)
        {
            try
            {
                // Create an instance of StreamReader to read from a file.
                // The using statement also closes the StreamReader.
                using (StreamReader sr = new StreamReader(filePathTextBox.Text))
                {
                    //to hold temporary X and Y values
                    Waveform tempwaveform = new Waveform();
                    //to parse each line in the file at either space or comma seperator
                    //trimming each line of white space at the beginning and end
                    DataStructures.UtilityClasses.WaveformParser p = new  DataStructures.UtilityClasses.WaveformParser(sr, @"[,\s]\s*", delegate(string s) { return s.Trim(); });

                    double[] values;
                    while ((values = p.ReadFloats()) != null)
                    {
                        //there should be two values, otherwise the file is formated wrong
                        if (values.Length != 2)
                            throw new System.ApplicationException("File should have two comma or tab separated numbers per line");

                        tempwaveform.XValues.Add(new DimensionedParameter(Units.s, values[0]));
                        tempwaveform.YValues.Add(new DimensionedParameter(new Units(currentWaveform.YUnits, Units.Multiplier.unity), values[1]));
                    }

                    currentWaveform.XValues = tempwaveform.XValues;
                    currentWaveform.YValues = tempwaveform.YValues;
                    currentWaveform.DataFileName = filePathTextBox.Text;
                    currentWaveform.WaveformDuration = (currentWaveform.XValues.Count > 0)
                        ? currentWaveform.XValues[currentWaveform.XValues.Count-1] : currentWaveform.WaveformDuration;
                    layoutNewWaveform();

                    updateGraph(this, null);
                }
            }
            catch (Exception ex)
            {
                // Let the user know what went wrong.
                MessageBox.Show("The file could not be read:\n" + ex.Message);
            }
        }