Example #1
0
 public static bool AddGeocache(Database db, GeocacheData gd)
 {
     bool result = true;
     if (!Core.Settings.Default.GeocacheIgnored(gd))
     {
         Geocache gc = db.GeocacheCollection.GetGeocache(gd.Code);
         if (gc == null)
         {
             gc = new Geocache(db, gd);
             gc.Selected = Core.Settings.Default.AutoSelectNewGeocaches;
         }
         else
         {
             if (gc.DataFromDate < gd.DataFromDate)
             {
                 gc.BeginUpdate();
                 GeocacheData.Copy(gd, gc);
                 gc.EndUpdate();
             }
         }
         Utils.Calculus.SetDistanceAndAngleGeocacheFromLocation(gc, ApplicationData.Instance.CenterLocation);
     }
     else
     {
         result = false;
     }
     return result;
 }
Example #2
0
 void cacheList_LoadingRow(object sender, System.Windows.Controls.DataGridRowEventArgs e)
 {
     // Get the DataRow corresponding to the DataGridRow that is loading.
     GAPPSF.Core.Data.Geocache item = e.Row.Item as GAPPSF.Core.Data.Geocache;
     if (item != null)
     {
         e.Row.Header = (e.Row.GetIndex() + 1).ToString();
     }
     else
     {
         e.Row.Visibility = System.Windows.Visibility.Collapsed;
     }
 }
Example #3
0
 public static bool AddGeocache(Database db, GeocacheData gd)
 {
     bool result = true;
     Geocache gc = db.GeocacheCollection.GetGeocache(gd.Code);
     if (gc == null)
     {
         gc = new Geocache(db, gd);
     }
     else
     {
         if (gc.DataFromDate<gd.DataFromDate)
         {
             gc.BeginUpdate();
             GeocacheData.Copy(gd, gc);
             gc.EndUpdate();
         }
     }
     Utils.Calculus.SetDistanceAndAngleGeocacheFromLocation(gc, ApplicationData.Instance.CenterLocation);
     return result;
 }
Example #4
0
        private string GetPostion(Geocache geocache)
        {
            double lat, lon;
            if (geocache.CustomLat != null)
            {
                lat = (double)geocache.CustomLat;
            }
            else 
            {
                lat = (double)geocache.Lat;
            }

            if (geocache.CustomLon != null)
            {
                lon = (double)geocache.CustomLon;
            }
            else 
            {
                lon = (double)geocache.Lon;
            }

            return Utils.Conversion.GetCoordinatesPresentation(lat, lon);
        }