public async Task <HashLocation> LoadHashLocation() { if (HomePageViewModel.Instance == null) { HomePageViewModel.Instance = this; } var loc = TappedLocation ?? CurrentLocation; if (loc == null) { return(null); } var hashData = await Hasher.GetHashData(Date, loc); if (hashData.Success) { var location = hashData.Data; GeohashLocations.Add(location); if (ShowNeighbours) { GeohashLocations.AddRange(location.Neighbours); } } HashLocation = hashData.Data; return(hashData.Data); }
private void ExecuteToggleNeighboursCommand(object obj) { ShowNeighbours = !ShowNeighbours; if (ShowNeighbours) { var neighbours = new List <HashLocation>(); foreach (var hash in GeohashLocations) { if (!hash.IsNeighbour) { neighbours.AddRange(hash.Neighbours); } } GeohashLocations.AddRange(neighbours); } else { var neighbours = GeohashLocations.Where(x => x.IsNeighbour).ToList(); foreach (var loc in neighbours) { GeohashLocations.Remove(loc); } } }
public async Task ExecuteResetCommand() { try { Date = DateTime.Today; TappedLocation = null; ShowNeighbours = false; GeohashLocations.Clear(); await LoadHashLocation(); } catch (Exception ex) { Crashes.TrackError(ex); } }