This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void FnGeoCodeApi() | |
{ | |
string strGeoCode = string.Format ("address={0}","Silicon Valley,CA,USA"); | |
string strGeoCodeFullURL = string.Format (Constants.strGeoCodingUrl,strGeoCode); | |
string strResult=await FnHttpRequest(strGeoCodeFullURL); | |
if ( strResult != Constants.strException ) | |
{ | |
var objGeoCodeClass= JsonConvert.DeserializeObject<GoogleGeoCodeClass> (strResult); | |
if ( objGeoCodeClass.status == "OK" ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Code snippet to mark source and destination points | |
Location SourceLocation{get;set;} | |
Location DestinationLocation{get;set;} | |
//mark source point | |
strGeoCodeURL =string.Format ("https://maps.googleapis.com/maps/api/geocode/json?address={0}&key={1}",strSource,"ApiKeygeoeshere"); | |
string strHttpResponse= await FnHttpRequest (strGeoCodeURL); | |
GeoCodeJSONClass objGeoCodeJSONClass = JsonConvert.DeserializeObject<GeoCodeJSONClass> (strHttpResponse); | |
//find GeoCodeJSONClass below in this page | |
if(objGeoCodeJSONClass!=null && objGeoCodeJSONClass.status=="OK") | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//rest request to google direction api | |
internal static string strGoogleDirectionUrl="https://maps.googleapis.com/maps/api/directions/json?origin=src_locn&destination=dest_lcn&key=keyGoesHere"; | |
string strJSONDirectionResponse = await FnHttpRequest(strGoogleDirectionUrl); | |
var objRoutes = JsonConvert.DeserializeObject<GoogleDirectionClass> ( jSonData ); | |
//find GoogleDirectionClass below in this page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Draw line by connecting polyline points | |
UIColor pathColor = UIColor.Red; | |
int intRoutesCount=objRoutes.routes.Count; | |
//available routes may be more then one | |
for ( int intCounter = 0 ; intCounter < intRoutesCount ; intCounter++ ) | |
{ | |
var path = Google.Maps.Path.FromEncodedPath ( objRoutes.routes [intCounter].overview_polyline.points ); | |
var line = Google.Maps.Polyline.FromPath ( path ); | |
line.StrokeWidth = 3f; | |
line.StrokeColor = UIColor.Red; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Google GeoCode class | |
public class AddressComponent | |
{ | |
public string long_name { get; set; } | |
public string short_name { get; set; } | |
public List<string> types { get; set; } | |
} | |
public class Northeast | |
{ | |
public double lat { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//GoogleDirectionClass.cs | |
public class GeocodedWaypoint | |
{ | |
public string geocoder_status { get; set; } | |
public string place_id { get; set; } | |
public List<string> types { get; set; } | |
} | |
public class Northeast | |
{ | |
public double lat { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//customized snackbar | |
void fnSnackBar( string strText,bool isLengthIndefinite) | |
{ | |
Snackbar objSnackBar = Snackbar.Make (linearLayoutMain, strText, isLengthIndefinite ? Snackbar.LengthIndefinite : Snackbar.LengthShort) | |
.SetAction (Resource.String.retry, (v) => { | |
//set action | |
}); | |
//set action button text color | |
objSnackBar.SetActionTextColor(Android.Graphics.Color.Aqua); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Android.Graphics; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Platform.Android; | |
using ACanvas = Android.Graphics.Canvas; | |
using Color = Android.Graphics.Color; | |
[assembly: ExportRenderer(typeof(Frame), typeof(FrameBugPoc.Droid.FrameRenderer))] | |
namespace FrameBugPoc.Droid | |
{ | |
public class FrameRenderer : Xamarin.Forms.Platform.Android.FrameRenderer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Platform.Android; | |
using System.ComponentModel; | |
using Android.Graphics; | |
using Android.Graphics.Drawables; | |
using AButton = Android.Widget.Button; | |
using ACanvas = Android.Graphics.Canvas; | |
using GlobalResource = Android.Resource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="rectangle"> | |
<stroke android:width="1dp" | |
android:color="#252525"/> | |
<corners android:radius="5dp" /> | |
<solid android:color="#FFFFFF" /> | |
</shape> |
OlderNewer