private void UpdateElevationDataSize()
        {
            var totalFileSize       = ElevationFileProvider.GetTotalElevationFileSize() / 1024f / 1024f;
            var totalFileSizeAsText = $"{totalFileSize:F1}";

            _textViewElevationDataSize.Text = String.Format(Resources.GetText(Resource.String.Settings_ElevationDataSize), totalFileSizeAsText);;
        }
Example #2
0
 public bool Exists()
 {
     if (!_fileExists.HasValue)
     {
         _fileExists = ElevationFileProvider.ElevationFileExists((int)StartLocation.Latitude, (int)StartLocation.Longitude);
     }
     return(_fileExists.Value);
 }
 private void ClearElevationData()
 {
     AlertDialog.Builder alert = new AlertDialog.Builder(this).SetCancelable(false);
     alert.SetPositiveButton(Resources.GetText(Resource.String.Common_Yes), (senderAlert, args) =>
     {
         ElevationFileProvider.ClearElevationData();
         AppContextLiveData.Instance.Database.DeleteAllDownloadedElevationData();
         UpdateElevationDataSize();
     });
     alert.SetNegativeButton(Resources.GetText(Resource.String.Common_No), (senderAlert, args) => { });
     alert.SetMessage(Resources.GetText(Resource.String.Settings_RemoveElevationDataQuestion));
     var answer = alert.Show();
 }
Example #4
0
 public bool Remove()
 {
     try
     {
         ElevationFileProvider.Remove((int)StartLocation.Latitude, (int)StartLocation.Longitude);
         return(true);
     }
     catch (Exception ex)
     {
         ErrorMessage = $"File delete error ({ex.Message})";
         return(false);
     }
 }
Example #5
0
 public bool Download()
 {
     try
     {
         ElevationFileProvider.GetElevationFile((int)StartLocation.Latitude, (int)StartLocation.Longitude);
         return(true);
     }
     catch (Exception ex)
     {
         ErrorMessage = $"Download error ({ex.Message})";
         return(false);
     }
 }
Example #6
0
 public bool LoadFromZip()
 {
     try
     {
         if (_elevationData == null)
         {
             if (ElevationFileProvider.ElevationFileExists((int)StartLocation.Latitude, (int)StartLocation.Longitude))
             {
                 var inputFileName = ElevationFileProvider.GetElevationFile((int)StartLocation.Latitude, (int)StartLocation.Longitude);
                 LoadFromZip(inputFileName);
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         ErrorMessage = $"Load error ({ex.Message})";
         return(false);
     }
 }
Example #7
0
 public long GetEelevationFileSize()
 {
     return(ElevationFileProvider.GetElevationFileSize((int)StartLocation.Latitude, (int)StartLocation.Longitude));
 }
 public float GetSizeToDownload()
 {
     return(_elevationTiles.Count(i => !i.Exists()) * ElevationFileProvider.GetFileSize());
 }