Example #1
0
 private void menuItemGPS_Start_Click(object sender, EventArgs e)
 {
     if (!GPS.IsPortOpen)
     {
         try
         {
             GPS.Start(frmGpsSettings.SerialPort, frmGpsSettings.BaudRate); //Open serial port
             menuItemGPS_Start.Text = "Stop";
         }
         catch (System.Exception ex)
         {
             MessageBox.Show("An error occured when trying to open port: " + ex.Message);
         }
     }
     else
     {
         GPS.Stop(); //Close serial port
         menuItemGPS_Start.Text = "Start";
     }
 }
Example #2
0
        private void menuItemGPS_Start_Click(object sender, EventArgs e)
        {
            if (!GPS.IsPortOpen)
            {
                try
                {
                    //GPS.EnableEmulate(@"..\Bristol_Nottingham.txt"); //Uncomment this and change filepath to valid NMEA log file for emulating GPS data

                    GPS.Start(frmGpsSettings.SerialPort, frmGpsSettings.BaudRate);                     //Open serial port
                    menuItemGPS_Start.Text = "Stop";
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("An error occured when trying to open port: " + ex.Message);
                }
            }
            else
            {
                GPS.Stop();                 //Close serial port
                menuItemGPS_Start.Text = "Start";
            }
        }