protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SearchJourney); #region setup map markers currentLocation = new MarkerOptions(); currentLocation.SetTitle("Current Position"); currentLocation.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue)); currentLocation.SetPosition(getCurrentPosition()); currentLocation.Visible(false); fromLocation = new MarkerOptions(); fromLocation.SetTitle("From Here"); fromLocation.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed)); fromLocation.SetPosition(getCurrentPosition()); fromLocation.Visible(false); toLocation = new MarkerOptions(); toLocation.SetTitle("To Here"); toLocation.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueGreen)); toLocation.SetPosition(getCurrentPosition()); toLocation.Visible(false); fromCircleOp = new CircleOptions(); fromCircleOp.InvokeCenter(getCurrentPosition()); fromCircleOp.InvokeRadius(1000); fromCircleOp.InvokeFillColor(0X66FF0000); fromCircleOp.InvokeStrokeColor(0X66FF0000); fromCircleOp.InvokeStrokeWidth(0); fromCircleOp.Visible(false); toCircleOp = new CircleOptions(); toCircleOp.InvokeCenter(getCurrentPosition()); toCircleOp.InvokeRadius(1000); toCircleOp.InvokeFillColor(Color.Green); toCircleOp.InvokeStrokeColor(Color.Green); toCircleOp.InvokeStrokeWidth(0); toCircleOp.Visible(false); #endregion // Create your application here InitMapFragment(); SetupCurrentLocationButton(); SetupSearchButton(); SetupSetFromButton(); SetupSetToButton(); SetupForm(); }
private void SetupSetToButton() { Button animateButton = FindViewById <Button>(Resource.Id.buttonSearchJourneySetTo); animateButton.Click += (sender, e) => { toLocation.SetPosition(_map.CameraPosition.Target); toLocation.Visible(true); if (toMarker != null) { toMarker.Remove(); } toMarker = _map.AddMarker(toLocation); toCircleOp.InvokeCenter(_map.CameraPosition.Target); toCircleOp.InvokeRadius(rangeFinder.Progress * 500); toCircleOp.Visible(true); if (toCircle != null) { toCircle.Remove(); } toCircle = _map.AddCircle(toCircleOp); }; }