async void OnDoneClick(object sender, EventArgs e)
        {
            if (ContentView.IsAnyRequiredFieldEmpty)
            {
                string text = "Please fill out all required fields";
                ContentView.Banner.SetInformationText(text, true);
                return;
            }

            ContentView.CancelCrosshairMode();
            PointClient.MarkerSource.Clear();
            ContentView.Popup.Hide();

            UIImage image = ContentView.Content.CameraField.Photo.Image;

            BucketResponse response1;

            if (image == null)
            {
                // Photo is an optional field.
                // Create a mock successful response,
                // if the user hasn't taken a photo
                response1      = new BucketResponse();
                response1.Path = "";
            }
            else
            {
                Stream stream = Camera.GetStreamFromImage(image);
                ContentView.Banner.ShowUploadingImage();
                string filename = ContentView.Content.CameraField.ImageName;
                response1 = await BucketClient.Upload(filename, stream);
            }

            if (response1.IsOk)
            {
                ContentView.Banner.ShowUploadingData();

                Data          item      = GetData(response1.Path);
                CartoResponse response2 = await Networking.Post(item);

                if (response2.IsOk)
                {
                    ContentView.Banner.Complete();
                }
                else
                {
                    ContentView.Banner.ShowFailedCartoUpload();
                    SQLClient.Instance.Insert(item);
                }
            }
            else
            {
                ContentView.Banner.ShowFailedAmazonUpload();
                Data item = GetData(Camera.LatestImageName);
                SQLClient.Instance.Insert(item);
            }

            ContentView.Content.Clear();
            PointClient.QueryPoints(delegate { });
        }
        public async void OnUploadAlertOK(UIAlertAction action)
        {
            List <Data> items = SQLClient.Instance.GetAll();
            int         count = items.Count;

            ContentView.Banner.ShowUploadingEverything(count);

            foreach (Data item in items)
            {
                if (!item.IsUploadedToAmazon)
                {
                    if (item.ImageUrl != "")
                    {
                        byte[]         bytes     = File.ReadAllBytes(FileUtils.GetFolder(item.ImageUrl));
                        Stream         stream    = new MemoryStream(bytes);
                        BucketResponse response1 = await BucketClient.Upload(item.FileName, stream);

                        if (response1.IsOk)
                        {
                            item.ImageUrl = response1.Path;
                            Console.WriteLine("Uploaded offline image to: " + response1.Path);
                        }
                    }
                }
            }

            CartoResponse response2 = await Networking.Post(items);

            if (response2.IsOk)
            {
                ContentView.Banner.ShowUploadedEverything(count);
                SQLClient.Instance.DeleteAll();
            }
            else
            {
                ContentView.Banner.ShowEverythingUploadFailed(count);
                SQLClient.Instance.UpdateAll(items);
            }
        }
        async void OnDoneClick(object sender, EventArgs e)
        {
            if (ContentView.IsAnyRequiredFieldEmpty)
            {
                ContentView.Banner.SetInformationText("Please fill our all required fields", true);
                return;
            }

            ContentView.CancelCrosshairMode();

            PointClient.MarkerSource.Clear();
            ContentView.Popup.Hide();
            ContentView.Banner.SetInformationText("Compressing image...", false);

            using (var stream = new MemoryStream())
            {
                Bitmap bitmap = ContentView.Content.CameraField.Photo;

                BucketResponse response1;
                string         filename;

                if (bitmap == null)
                {
                    // Photo is an optional field.
                    // Create a mock successful response,
                    // if the user hasn't taken a photo
                    response1      = new BucketResponse();
                    response1.Path = "";
                    filename       = "";
                }
                else
                {
                    bitmap.Compress(Bitmap.CompressFormat.Png, Quality, stream);

                    filename = ContentView.Content.CameraField.ImageName;

                    ContentView.Banner.ShowUploadingImage();

                    response1 = await BucketClient.Upload(filename, stream);
                }

                if (response1.IsOk)
                {
                    ContentView.Banner.ShowUploadingData();

                    Data          item      = GetData(response1.Path);
                    CartoResponse response2 = await Networking.Post(item);

                    if (response2.IsOk)
                    {
                        ContentView.Banner.Complete();
                    }
                    else
                    {
                        ContentView.Banner.ShowFailedCartoUpload();
                        SQLClient.Instance.Insert(item);
                    }
                }
                else
                {
                    ContentView.Banner.ShowFailedAmazonUpload();
                    Data item = GetData(filename);
                    SQLClient.Instance.Insert(item);
                }

                ContentView.Content.Clear();
                PointClient.QueryPoints(delegate { });
            }
        }