/// <summary> /// Gets the grid coordinates. /// </summary> /// <param name="latitude">The latitude.</param> /// <param name="longitude">The longitude.</param> /// <returns> /// GridValues. /// </returns> public async Task <GridValues> GetGridCoordinates(double latitude, double longitude) { var result = new GridValues(); var response = await this.service.GetGridCoordinates(latitude, longitude); if (response is GridCoordinates) { var coordinates = response.Properties; if (coordinates is GridCoordinatesProperties) { result.City = coordinates.RelativeLocation?.Properties?.City; result.Id = coordinates.GridId; result.X = coordinates.GridX; result.Y = coordinates.GridY; result.Success = true; } } else { result.Success = false; result.ErrorMessage = "No results"; } return(result); }
public override void Dispose() { if (GridValues != null) { GridValues.Clear(); } GridValues = null; }
public Sprite getSpriteForState(GridValues value) { switch (value) { case GridValues.x: return(xMark); case GridValues.o: return(oMark); case GridValues.empty: return(emptyMark); default: Debug.LogError("invalid state for sub space sprite " + gridNumber); return(emptyMark); } }
public async Task <IActionResult> GetGeoCoordinates(string address) { var geoResponse = await this.geoCodeRepository.GetGeoCoding(address); var forecastResponse = new Forecast(); var gridResponse = new GridValues(); if (geoResponse.Success) { gridResponse = await this.weatherRepository.GetGridCoordinates(geoResponse.Latitude, geoResponse.Longitude); if (gridResponse.Success) { forecastResponse = await this.weatherRepository.GetForecast(gridResponse.Id, gridResponse.X, gridResponse.Y); } } else { try { var accountSid = this.configuration["AC3fc267ebadfc32ccba879a8af06a2865"]; var authToken = this.configuration["fca9b6bcca2348c56a583ab31854ce22"]; var phoneTo = this.configuration["SupportPhone"]; var phoneFrom = this.configuration["FromPhone"]; TwilioClient.Init(accountSid, authToken); var message = MessageResource.Create( body: "There was an error trying to get the geo information", from: new Twilio.Types.PhoneNumber(phoneFrom), to: new Twilio.Types.PhoneNumber(phoneTo)); } catch (Exception ex) { this.logger.Log(LogLevel.Error, "Twilio failed.", ex.Message); } } return(new JsonResult(new { data = forecastResponse?.Properties?.Periods, City = gridResponse.City, success = forecastResponse.Success })); }
public void displayMarker(GridValues value) { hideSmallGrid(); switch (value) { case GridValues.x: spaceImage.sprite = xMark; break; case GridValues.o: spaceImage.sprite = oMark; break; case GridValues.empty: spaceImage.sprite = emptyMark; break; default: Debug.LogError("not valid value. Grid space:" + gridNumber); break; } }