public void GetLocation() { if (_addressText != "" && _currentLocation != null) { var crashLocationResult = new CrashLocationResult { AddressAsString = _addressText, Lat = _currentLocation.Latitude, Lng = _currentLocation.Longitude }; MessagingCenter.Send<IGetLocation, CrashLocationResult>(this, "addressExists", crashLocationResult); } //send location to msg center; }
private void SaveAddress(Address address) { if (address != null) { string deviceAddress = ""; for (int i = 0; i < address.MaxAddressLineIndex; i++) { deviceAddress += address.GetAddressLine(i) + ", "; } deviceAddress = deviceAddress.Trim(); deviceAddress = deviceAddress.TrimEnd(','); _addressText = deviceAddress; var crashLocationResult = new CrashLocationResult { Address = new DTO.Location { HouseNameOrNumber = address.FeatureName, Country = address.CountryName, PostCode = address.PostalCode, Town = address.Locality, StreetName = address.Thoroughfare }, Lat = _currentLocation.Latitude, Lng = _currentLocation.Longitude, AddressAsString = _addressText }; MessagingCenter.Send<IGetLocation, CrashLocationResult>(this, "addressExists", crashLocationResult); } else { _addressText = ""; } //push the data to the message centre!!! }