Exemplo n.º 1
0
        //add track data to database (to gpsData table) and clear list of position
        public void addTrackData(GPS.Position <GpsPosition> positionList)
        {
            GpsPosition[] positionArray =new GpsPosition[positionList.Count];
            positionList.CopyTo(positionArray, 0);
            positionList.Clear();
            StringBuilder query = new StringBuilder();
            try
            {
                foreach (GpsPosition pos in positionArray)
                {
                    query.Append("INSERT INTO gpsData ('trackId', 'longitude', 'latitude', 'altitude', 'fix') VALUES (");
                    query.Append(trackId + ", '");
                    query.Append(pos.Longitude + "', '");
                    query.Append(pos.Latitude + "', '");
                    query.Append(pos.SeaLevelAltitude + "', '");
                    query.Append((int)pos.PositionDilutionOfPrecision + "');");

                }

                createSqliteConn();

                executeQuery(query, false);

                closeSqliteConn();

            }
            catch (SQLiteException sqliteEx)
            {
                MessageBox.Show("exception "+ sqliteEx.Message);
            }
        }