Example #1
0
        private async Task FoodMarkerOnDelete(int foodMarkerId)
        {
            BottomSheetVC.HideBottomSheet(View.Frame.GetMaxY());

            FoodMarkerService foodMarkerService = new FoodMarkerService();
            bool isSuccess = await foodMarkerService.DeleteFoodMarker(foodMarkerId);

            if (!isSuccess)
            {
                UIImageView errorView = new UIImageView();
                errorView.Image = UIImage.FromBundle("ErrorScreen");
                double side = (View.Frame.Width * 2.0 / 3.0);
                errorView.Frame  = new CoreGraphics.CGRect(0, 0, side, side);
                errorView.Center = View.Center;
                View.AddSubview(errorView);
                View.BringSubviewToFront(errorView);
                NSTimer.CreateScheduledTimer(3.0, delegate
                {
                    errorView.RemoveFromSuperview();
                });
                return;
            }
            if (_foodMarkerAnnotationDict.ContainsKey(foodMarkerId))
            {
                MapView.RemoveAnnotation(_foodMarkerAnnotationDict[foodMarkerId]);
            }
        }