コード例 #1
0
        private void UpdateData()
        {
            if (StaticGPS.isOpened())
            {
                if (StaticGPS.position != null)
                {
                    if (StaticGPS.position.LatitudeValid)
                    {
                        if (locGPS != null)
                        {
                            this.textBoxLatitude.Text        = StaticGPS.position.Latitude.ToString();
                            this.locGPS.AverageLatitudeCache = float.Parse(this.textBoxLatitude.Text, System.Globalization.CultureInfo.CurrentUICulture);
                        }
                    }

                    if (StaticGPS.position.LongitudeValid)
                    {
                        if (locGPS != null)
                        {
                            this.textBoxLongitude.Text        = StaticGPS.position.Longitude.ToString();
                            this.locGPS.AverageLongitudeCache = float.Parse(this.textBoxLongitude.Text, System.Globalization.CultureInfo.CurrentUICulture);
                        }
                    }

                    if (StaticGPS.position.SeaLevelAltitudeValid)
                    {
                        if (locAlt != null)
                        {
                            this.textBoxAltitude.Text        = StaticGPS.position.SeaLevelAltitude.ToString();
                            this.locAlt.AverageAltitudeCache = float.Parse(this.textBoxAltitude.Text, System.Globalization.CultureInfo.CurrentUICulture);
                        }
                    }
                }
            }
        }
コード例 #2
0
 private void actualizePosition()
 {
     if (StaticGPS.isOpened())
     {
         if (StaticGPS.position != null)
         {
             try
             {
                 float latitude  = float.Parse(StaticGPS.position.Latitude.ToString());
                 float longitude = float.Parse(StaticGPS.position.Longitude.ToString());
                 float altitude  = float.Parse(StaticGPS.position.SeaLevelAltitude.ToString());
                 this._actualLat    = latitude;
                 this._actualLon    = longitude;
                 this._actualLatPos = this.calculateTop(this._actualLat);
                 this._actualLonPos = this.calculateLeft(this._actualLon);
             }
             catch (Exception)
             {
                 Cursor.Current = Cursors.Default;
                 throw new DataFunctionsException("GPS-Data couldn`t be read. Data will be set to default values.");
             }
         }
     }
 }