コード例 #1
0
        private void CheckCanUpload(int index)
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                AppUtils.ShowSimpleDialog(this, "Unable to Upload", "An Internet connection is required.", "Got it");
                return;
            }

            // Check if on WiFi
            var currentConnections = CrossConnectivity.Current.ConnectionTypes;

            if (!currentConnections.Contains(Plugin.Connectivity.Abstractions.ConnectionType.WiFi))
            {
                AppUtils.ShowChoiceDialog(
                    this,
                    "You're not on WiFi!",
                    "Uploading over mobile data could incur additional charges. Are you sure you want to upload without a WiFi connection?",
                    "Yes, upload",
                    (resIndex) => { var suppress = UploadResults(resIndex, UploadsComplete); },
                    "Cancel",
                    null,
                    index);
            }
            else
            {
                var suppress = UploadResults(index, UploadsComplete);
            }
        }
コード例 #2
0
 private void FinishButton_TouchUpInside(object sender, EventArgs e)
 {
     AppUtils.ShowChoiceDialog(this,
                               "Finish?",
                               "Are you sure you're finished creating your activity? You can't edit past this point.",
                               "Finish",
                               (arg) => { var suppress = SaveAndFinish(); },
                               "Cancel",
                               null,
                               true);
 }
コード例 #3
0
 private void CheckShouldDelete(int index)
 {
     AppUtils.ShowChoiceDialog(
         this,
         "Delete?",
         "Are you sure you want to delete these files? This can't be undone!",
         "Delete",
         (resIndex) => { var suppress = DeleteResults(resIndex); },
         "Cancel",
         null,
         index);
 }
コード例 #4
0
        public async Task PackageForUpload()
        {
            List <AppTask> preppedTasks = new List <AppTask>();

            foreach (AppTask t in ((TaskViewSource)TableView.Source).Rows)
            {
                if (t == null)
                {
                    continue;
                }

                preppedTasks.Add(PrepForUpload(t, true));
            }

            await ImageService.Instance.InvalidateCacheAsync(FFImageLoading.Cache.CacheType.All);

            // Skip packaging the upload if there is no entered data
            bool anyData = false;

            foreach (AppTask t in preppedTasks)
            {
                if (!string.IsNullOrWhiteSpace(t.CompletionData.JsonData))
                {
                    anyData = true;
                }
            }
            if (!anyData)
            {
                NavigationController.PopViewController(true);
                return;
            }

            ApplicationUser creator = DisplayedActivity.Author;

            if (creator != null && creator.Id != (await GetDatabaseManager()).currentUser.Id)
            {
                string name = creator.FirstName[0] + ". " + creator.Surname;

                AppUtils.ShowChoiceDialog(this,
                                          string.Format("Share with {0}?", name),
                                          string.Format("Do you want to share your results with this activity's creator, {0}?", name),
                                          "Yes, share",
                                          (preppedRes) => { AddToUploads(preppedTasks, true); },
                                          "No",
                                          (preppedRes) => { AddToUploads(preppedTasks, false); },
                                          preppedTasks);
            }
            else
            {
                AddToUploads(preppedTasks, false);
            }
        }
コード例 #5
0
        private void ClosePressed(object sender, EventArgs e)
        {
            if (!editingSubmitted)
            {
                NavigationController.DismissViewController(true, null);
                return;
            }

            AppUtils.ShowChoiceDialog(
                this,
                "Cancel editing?",
                "Going back will discard any changes you've made. Are you sure?",
                "Discard changes", (res) =>
            {
                NavigationController.DismissViewController(true, null);
            },
                "Cancel",
                null, thisActivity, UIAlertActionStyle.Destructive);
        }
コード例 #6
0
 private void DeleteActivity(object sender, EventArgs e)
 {
     AppUtils.ShowChoiceDialog(
         this,
         string.Format("Delete '{0}'?", thisActivity.Name),
         "Are you sure you want to delete this activity? This can't be undone.",
         "Delete", (res) =>
     {
         if (editingSubmitted)
         {
             var suppress = DeleteRemoteActivity();
         }
         else
         {
             var suppress = DeleteLocalActivity();
         }
     },
         "Cancel",
         null, thisActivity, UIAlertActionStyle.Destructive);
 }
コード例 #7
0
        private bool TappedMarker(MapView mapView, Marker marker)
        {
            CATransaction.Begin();
            CATransaction.AnimationDuration = 0.5;  // 1 second animation
            var cam = new CameraPosition(marker.Position, 16, 0, 0);

            mapView.Animate(cam);
            CATransaction.Commit();

            AppUtils.ShowChoiceDialog(this, "Remove Marker?",
                                      "Do you want to delete this marker?",
                                      "Yes", (mrk) => {
                mrk.Map = null;
                markers.Remove(mrk);
                MarkLocButton.Enabled = CheckThisLocationMarked();
                UpdateText();
            },
                                      "No", (mrk) => { }, marker);
            return(true);
        }
コード例 #8
0
        private void UploadAllButton_TouchUpInside(object sender, EventArgs e)
        {
            string message = "Are you sure you want to upload all of the items in the queue?";

            // Check if on WiFi
            var currentConnections = CrossConnectivity.Current.ConnectionTypes;

            if (!currentConnections.Contains(Plugin.Connectivity.Abstractions.ConnectionType.WiFi))
            {
                message += "\nWARNING: You are not on WiFi! You may incur additional network charges!";
            }

            AppUtils.ShowChoiceDialog(
                this,
                "Upload all items?",
                message,
                "Yes, upload",
                (a) => { var suppress = UploadAll(); },
                "Cancel",
                null,
                1);
        }