summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs
diff options
context:
space:
mode:
authorchungryeol lim <cdark.lim@samsung.com>2016-12-20 20:16:18 +0900
committerKangho Hur <kangho.hur@samsung.com>2017-07-10 11:11:16 +0900
commit28ad177fd48d37e4110b636cc17330d8dd08eb5f (patch)
tree35fd1e6133c2d8ebca0e1945b4fe9c03dee5c8af /Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs
parent002608d955237854b22581d2f60085d5ab65417a (diff)
downloadxamarin-forms-28ad177fd48d37e4110b636cc17330d8dd08eb5f.tar.gz
xamarin-forms-28ad177fd48d37e4110b636cc17330d8dd08eb5f.tar.bz2
xamarin-forms-28ad177fd48d37e4110b636cc17330d8dd08eb5f.zip
Add MapRenderer to enable Xamarin.Forms.Maps on Tizen
- Implementation of MapRenderer under Xamarin.Forms.Maps.Tizen - Implementation of FormsMaps to initialize Tizen Map - Implementation of GeocoderBackend TASK=TCAPI2044 Change-Id: I4b6f15b5190767ca0c92bb27c383af5f66ae5328
Diffstat (limited to 'Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs')
-rwxr-xr-x[-rw-r--r--]Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs41
1 files changed, 24 insertions, 17 deletions
diff --git a/Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs b/Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs
index a18990d4..dbf93979 100644..100755
--- a/Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs
+++ b/Xamarin.Forms.Maps.Tizen/GeocoderBackend.cs
@@ -1,25 +1,32 @@
´╗┐using System.Collections.Generic;
using System.Threading.Tasks;
-using System;
namespace Xamarin.Forms.Maps.Tizen
{
- public class Position {};
+ internal class GeocoderBackend
+ {
+ public static void Register()
+ {
+ Geocoder.GetPositionsForAddressAsyncFunc = GetPositionsForAddressAsync;
+ Geocoder.GetAddressesForPositionFuncAsync = GetAddressesForPositionAsync;
+ }
- internal class GeocoderBackend
- {
- public static void Register()
- {
- }
+ public static async Task<IEnumerable<Position>> GetPositionsForAddressAsync(string address)
+ {
+ var request = FormsMaps.MapService.CreateGeocodeRequest(address);
+ var positions = new List<Position>();
+ foreach (var result in await request.GetResponseAsync())
+ positions.Add(new Position(result.Latitude, result.Longitude));
+ return positions;
+ }
- public static async Task<IEnumerable<Position>> GetPositionsForAddressAsync(string address)
- {
- return new Position[]{};
- }
-
- public static async Task<IEnumerable<string>> GetAddressesForPositionAsync(Position position)
- {
- return new String[]{"Not supported"};
- }
- }
+ public static async Task<IEnumerable<string>> GetAddressesForPositionAsync(Position position)
+ {
+ var request = FormsMaps.MapService.CreateReverseGeocodeRequest(position.Latitude, position.Longitude);
+ var addresses = new List<string>();
+ foreach (var result in await request.GetResponseAsync())
+ addresses.Add(result.Freetext);
+ return addresses;
+ }
+ }
} \ No newline at end of file