public async void GetWellDetail() { IsBusy = true; _well = await _param.Api.GetWellByName(_param.Ticket.Location); IsBusy = false; var wellPosition = new Position(_well.Latitude, _well.Longitude); var pin = new Pin { Type = PinType.Place, Position = wellPosition, Label = _well.WellName ?? string.Empty, Address = _well.Description }; Messenger.Default.Send(pin); }
public async Task <WellItem> GetWellByName(string wellName) { var uri = new Uri(baseURL + "/_vti_bin/listdata.svc/Well()?$filter=GRID_NAME eq '" + wellName + "'"); WellItem result = new WellItem(); try { var response = await client.GetAsync(uri); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); var contentTemp = JsonConvert.DeserializeObject <WellResponseJSON>(content); List <ResultWell> resultTemp = contentTemp.d.results; if (resultTemp.Count == 1) { result.WellName = resultTemp[0].GRID_NAME; result.Latitude = Convert.ToDouble(resultTemp[0].Latitude); result.Longitude = Convert.ToDouble(resultTemp[0].Longitude); result.Description = resultTemp[0].Description; return(result); } else { Messenger.Default.Send(new NotificationMessage("Well Not Found !")); } } } catch (Exception e) { Messenger.Default.Send(new NotificationMessage(e.Message)); } return(null); }
public async void GetWellDetail(string wellname) { WellMapsAPI api = new WellMapsAPI(_credential); IsBusy = true; WellItem well = await api.GetWellByName(wellname); IsBusy = false; if (well != null) { var wellPosition = new Position(well.Latitude, well.Longitude); var pin = new Pin { Type = PinType.Place, Position = wellPosition, Label = well.WellName ?? string.Empty, Address = well.Description }; Messenger.Default.Send(pin); } }