Changeset - 105a3022c22b
[Not reviewed]
default
0 2 0
mkanning@CL-ENS241-10.cedarville.edu - 13 years ago 2013-02-21 15:29:54
mkanning@CL-ENS241-10.cedarville.edu
fixed the chart cross threading issue, renamed items on form
2 files changed with 52 insertions and 14 deletions:
0 comments (0 inline, 0 general)
Demo.WindowsForms/Forms/MainForm.Designer.cs
Show inline comments
 
@@ -1554,9 +1554,9 @@
 
            this.lblBottomRightChartTitle.AutoSize = true;
 
            this.lblBottomRightChartTitle.Location = new System.Drawing.Point(0, 186);
 
            this.lblBottomRightChartTitle.Name = "lblBottomRightChartTitle";
 
            this.lblBottomRightChartTitle.Size = new System.Drawing.Size(28, 13);
 
            this.lblBottomRightChartTitle.Size = new System.Drawing.Size(44, 13);
 
            this.lblBottomRightChartTitle.TabIndex = 2;
 
            this.lblBottomRightChartTitle.Text = "Map";
 
            this.lblBottomRightChartTitle.Text = "Velocity";
 
            // 
 
            // chrtBottomRight
 
            // 
Demo.WindowsForms/Forms/MainForm.cs
Show inline comments
 
@@ -47,6 +47,7 @@ namespace Demo.WindowsForms
 
        PointLatLng start;
 
        PointLatLng end;
 
        TimeSpan unixTime;
 
 
        public MainForm()
 
        {
 
            InitializeComponent();
 
@@ -2565,6 +2566,7 @@ namespace Demo.WindowsForms
 
            //check to see if data should be processed
 
            if (!cboxCollectData.Checked && rawDataReceived.StartsWith("KD8TDF"))
 
            {
 
                AddTextDelegate("Bad transmission: " + rawDataReceived);
 
                return;
 
            }
 
 
@@ -2619,7 +2621,7 @@ namespace Demo.WindowsForms
 
            //handle case of no GPS fix
 
            if (latitude == "" || longitude == "")
 
            {
 
                AddText("No GPS fix: ");
 
                AddTextDelegate("No GPS fix: ");
 
            }
 
            else
 
            {
 
@@ -2628,7 +2630,7 @@ namespace Demo.WindowsForms
 
            }
 
 
            //display transmission in message box
 
            AddText(rawDataReceived + "\r\n");
 
            AddTextDelegate(rawDataReceived + "\r\n");
 
 
            //write the data to CSV file
 
            WriteToCSV(csvData);
 
@@ -2669,11 +2671,11 @@ namespace Demo.WindowsForms
 
            }
 
            else if (dataType.Equals("V"))  //Velocity
 
            {
 
                chrtBottomRight.Series.FindByName("velocityTrend").Points.AddY(data);
 
                bottomRightChartDelegate(dataType, data);
 
            }
 
            else if (dataType.Equals("I"))  //Info/error Message
 
            {
 
                AddText("Info: " + data + "\r\n");
 
                AddTextDelegate("Info: " + data + "\r\n");
 
            }
 
            else if (dataType.Equals("_"))  //extra latitude decimals
 
            {
 
@@ -2695,15 +2697,15 @@ namespace Demo.WindowsForms
 
            }
 
            else if (dataType.Equals("H"))  //Humidity
 
            {
 
                chrtTopRight.Series.FindByName("humidityTrend").Points.AddY(data);
 
                topRightChartDelegate(dataType, data);
 
            }
 
            else if (dataType.Equals("P"))  //Pressure
 
            {
 
                chrtBottomLeft.Series.FindByName("pressureTrend").Points.AddY(data);
 
                bottomLeftChartDelegate(dataType, data);
 
            }
 
            else if (dataType.Equals("A"))  //Altitude
 
            {
 
                chrtTopLeft.Series.FindByName("altitudeTrend").Points.AddY(data);
 
                topLeftChartDelegate(dataType, data);
 
            }
 
 
            //GEIGER MODULE DATA VALUES
 
@@ -2779,11 +2781,11 @@ namespace Demo.WindowsForms
 
 
        //these are for function calls across threads
 
        delegate void SetTextDelegate(string value);
 
        public void AddText(string value)
 
        public void AddTextDelegate(string value)
 
        {
 
            if (InvokeRequired)
 
            {
 
                Invoke(new SetTextDelegate(AddText), value);
 
                Invoke(new SetTextDelegate(AddTextDelegate), value);
 
            }
 
            else
 
            {
 
@@ -2793,15 +2795,51 @@ namespace Demo.WindowsForms
 
        }
 
 
        delegate void ChartDataDelegate(string dataType, double data);
 
        public void AddDataToChart(string dataType, double data)
 
        public void topLeftChartDelegate(string dataType, double data)
 
        {
 
            if (InvokeRequired)
 
            {
 
                Invoke(new ChartDataDelegate(topLeftChartDelegate), dataType, data);
 
            }
 
            else
 
            {
 
                chrtTopLeft.Series.FindByName("altitudeTrend").Points.AddY(data);
 
            }
 
        }
 
 
        public void topRightChartDelegate(string dataType, double data)
 
        {
 
            if (InvokeRequired)
 
            {
 
                Invoke(new ChartDataDelegate(AddDataToChart), dataType, data);
 
                Invoke(new ChartDataDelegate(topRightChartDelegate), dataType, data);
 
            }
 
            else
 
            {
 
                processTransmissionDatum(dataType, data);
 
                chrtTopRight.Series.FindByName("humidityTrend").Points.AddY(data); 
 
            }
 
        }
 
 
        public void bottomLeftChartDelegate(string dataType, double data)
 
        {
 
            if (InvokeRequired)
 
            {
 
                Invoke(new ChartDataDelegate(bottomLeftChartDelegate), dataType, data);
 
            }
 
            else
 
            {
 
                chrtBottomLeft.Series.FindByName("pressureTrend").Points.AddY(data);
 
            }
 
        }
 
 
        public void bottomRightChartDelegate(string dataType, double data)
 
        {
 
            if (InvokeRequired)
 
            {
 
                Invoke(new ChartDataDelegate(bottomRightChartDelegate), dataType, data);
 
            }
 
            else
 
            {
 
                chrtBottomRight.Series.FindByName("velocityTrend").Points.AddY(data);
 
            }
 
        }
 
0 comments (0 inline, 0 general)