private void PlaceMarkerAtCoord(CLLocationCoordinate2D coord)
        {
            var color  = UIColor.FromHSBA((float)AppUtils.GetRandomNumber(), 1, 1, 1.0f);
            var marker = Marker.FromPosition(coord);

            marker.AppearAnimation = MarkerAnimation.Pop;
            marker.Icon            = Marker.MarkerImage(color);
            marker.Map             = mapView;
            markers.Add(marker);

            UpdateText();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (thisTask == null)
            {
                AppUtils.ShowSimpleDialog(this, "ERROR", "Error loading task data", "Ok");
                NavigationController.PopViewController(true);
                return;
            }

            taskData = JsonConvert.DeserializeObject <MapMarkerTaskData>(thisTask.JsonData);

            markers         = new List <Marker>();
            mapView.MapType = MapViewType.Hybrid;
            mapView.Settings.MyLocationButton = true;

            if (!string.IsNullOrWhiteSpace(thisTask.CompletionData.JsonData))
            {
                // load previously placed markers
                Map_Location[] locs = JsonConvert.DeserializeObject <Map_Location[]>(thisTask.CompletionData.JsonData);

                if (locs != null)
                {
                    foreach (Map_Location loc in locs)
                    {
                        CLLocationCoordinate2D coord = new CLLocationCoordinate2D(loc.Lat, loc.Long);
                        var color  = UIColor.FromHSBA((float)AppUtils.GetRandomNumber(), 1, 1, 1.0f);
                        var marker = Marker.FromPosition(coord);
                        marker.AppearAnimation = MarkerAnimation.Pop;
                        marker.Icon            = Marker.MarkerImage(color);
                        marker.Map             = mapView;
                        markers.Add(marker);
                    }
                }
            }

            UpdateText();
            TaskDescLabel.Text = thisTask.Description;

            // Listen to the myLocation property of GMSMapView.
            mapView.AddObserver(this, new NSString("myLocation"), NSKeyValueObservingOptions.New, IntPtr.Zero);

            mapView.CoordinateTapped += CoordinateTapped;
            mapView.TappedMarker     += TappedMarker;

            // Ask for My Location data after the map has already been added to the UI.
            InvokeOnMainThread(() => mapView.MyLocationEnabled = true);

            MarkLocButton.TouchUpInside        += AddMarkerOnPosition;
            ProgressFinishButton.TouchUpInside += FinishButtonPressed;
        }
        private void PlaceMarkerAtCoord(CLLocationCoordinate2D coord)
        {
            var color = UIColor.FromHSBA((float)AppUtils.GetRandomNumber(), 1, 1, 1.0f);

            if (currentMarker != null)
            {
                currentMarker.Map = null;
            }

            currentMarker = Marker.FromPosition(coord);
            currentMarker.AppearAnimation = MarkerAnimation.Pop;
            currentMarker.Icon            = Marker.MarkerImage(color);
            currentMarker.Map             = mapView;
            chosenLocation = new Map_Location(coord.Latitude, coord.Longitude, 15f);
        }