private bool DeleteIfOld(string file, TimeSpan maxFileAge) { var lastWriteTime = _fileStore.GetLastWriteTime(file); var fileAge = DateTime.Now - lastWriteTime; if (fileAge > maxFileAge) { try { _fileStore.DeleteFile(file); return(true); } catch (Exception ex) { _exceptionPolicy.Trace(ex, false); } } return(false); }
private async Task UpdateLocationString() { var result = default(string); if (IsLocationAccessible && CurrentLocation != Location.Empty) { var isConnected = await _reachabilityService.GetIsReachable(); if (isConnected) { var placemarks = default(CLPlacemark[]); try { var location = new CLLocation( CurrentLocation.Latitude, CurrentLocation.Longitude); placemarks = await _geocoder .ReverseGeocodeLocationAsync(location); } catch (Exception ex) { _exceptionPolicy.Trace(ex, false); } if (placemarks != null) { var placemark = placemarks.FirstOrDefault(); if (placemark != null && placemark.Locality != null) { result = placemark.Locality; } } } } CurrentLocationString = result; }