private Anchor createAnchor(HitResult hitResult)
        {
            AnchorVisual visual = new AnchorVisual(hitResult.CreateAnchor());

            visual.SetColor(readyColor);
            visual.Render(arFragment);
            anchorVisuals[""] = visual;

            RunOnUiThread(() =>
            {
                scanProgressText.Visibility = ViewStates.Visible;
                if (enoughDataForSaving)
                {
                    statusText.Text         = "Ready to save";
                    actionButton.Text       = "Save cloud anchor";
                    actionButton.Visibility = ViewStates.Visible;
                }
                else
                {
                    statusText.Text = "Move around the anchor";
                }
            });

            currentDemoStep = DemoStep.SaveCloudAnchor;

            return(visual.LocalAnchor);
        }
        private Anchor createAnchor(HitResult hitResult)
        {
            AnchorVisual visual = new AnchorVisual(hitResult.CreateAnchor());

            visual.SetColor(readyColor);
            visual.Render(arFragment);
            anchorVisuals[""] = visual;

            return(visual.LocalAnchor);
        }
        private void renderLocatedAnchor(CloudSpatialAnchor anchor)
        {
            AnchorVisual foundVisual = new AnchorVisual(anchor.LocalAnchor);

            foundVisual.SetCloudAnchor(anchor);
            foundVisual.AnchorNode.SetParent(arFragment.ArSceneView.Scene);
            String cloudAnchorIdentifier = foundVisual.CloudAnchor.Identifier;

            foundVisual.SetColor(foundColor);
            foundVisual.Render(arFragment);
            anchorVisuals[cloudAnchorIdentifier] = foundVisual;
        }
        private void anchorLookedUp(String anchorId)
        {
            Log.Debug("ASADemo", "anchor " + anchorId);
            this.anchorId = anchorId;
            destroySession();

            cloudAnchorManager = new AzureSpatialAnchorsManager(sceneView.Session);
            cloudAnchorManager.AnchorLocated += (s, e) =>
                                                RunOnUiThread(() =>
            {
                CloudSpatialAnchor anchor = e.P0.Anchor;
                if (e.P0.Status == LocateAnchorStatus.AlreadyTracked || e.P0.Status == LocateAnchorStatus.Located)
                {
                    AnchorVisual foundVisual = new AnchorVisual(anchor.LocalAnchor);
                    foundVisual.SetCloudAnchor(anchor);
                    foundVisual.AnchorNode.SetParent(arFragment.ArSceneView.Scene);
                    String cloudAnchorIdentifier = foundVisual.CloudAnchor.Identifier;
                    foundVisual.SetColor(foundColor);
                    foundVisual.Render(arFragment);
                    anchorVisuals[cloudAnchorIdentifier] = foundVisual;
                }
            });


            cloudAnchorManager.LocateAnchorsCompleted += (s, e) =>
            {
                currentStep = DemoStep.Choosing;

                RunOnUiThread(() =>
                {
                    textView.Text = "Anchor located!";
                    enableCorrectUIControls();
                });
            };
            cloudAnchorManager.Start();
            AnchorLocateCriteria criteria = new AnchorLocateCriteria();

            criteria.SetIdentifiers(new string[] { anchorId });
            cloudAnchorManager.StartLocating(criteria);
        }