public async void OnLocateButtonClicked(object sender, EventArgs args)
        {
            if (this.currentStep == DemoStep.DemoStepChoosing)
            {
                this.currentStep   = DemoStep.DemoStepEnteringAnchorNumber;
                this.textView.Text = "Enter an anchor number and press locate";
                this.EnableCorrectUIControls();
            }
            else
            {
                string inputVal = this.anchorNumInput.Text;
                if (!string.IsNullOrEmpty(inputVal))
                {
                    RetrieveAnchorResponse response = await this.anchorSharingServiceClient.RetrieveAnchorIdAsync(inputVal);

                    if (response.AnchorFound)
                    {
                        this.AnchorLookedUp(response.AnchorId);
                    }
                    else
                    {
                        this.RunOnUiThread(() => {
                            this.currentStep = DemoStep.DemoStepChoosing;
                            this.EnableCorrectUIControls();
                            this.textView.Text = "Anchor number not found or has expired.";
                        });
                    }

                    this.currentStep = DemoStep.DemoStepLocating;
                    this.EnableCorrectUIControls();
                }
            }
        }
Beispiel #2
0
        private async void MainButton_TouchUpInsideAsync(object sender, EventArgs e)
        {
            Debug.WriteLine("CURRENT STEP VALUE :: " + this.step);
            if (this.step == DemoStep.Start)
            {
                this.step = DemoStep.EnterAnchorNumber;
                this.InvokeOnMainThread(() =>
                {
                    this.ignoreMainButtonTaps = true;
                    this.mainButton.Hidden    = true;
                    this.locateButton.Hidden  = false;
                    this.anchorIdEntry.Hidden = false;
                    this.anchorIdLabel.Hidden = false;
                });
            }
            else
            {
                string inputVal = this.anchorIdEntry.Text;
                this.anchorIdEntry.Hidden = true;
                this.anchorIdLabel.Hidden = true;
                this.locateButton.Hidden  = true;
                this.StartSession();
                if (!string.IsNullOrEmpty(inputVal))
                {
                    RetrieveAnchorResponse response = await this.anchorSharingServiceClient.RetrieveAnchorIdAsync(inputVal);

                    Debug.WriteLine("RESPONSE VALUE :: " + response.AnchorId + " ANCHOR Found :: " + response.AnchorFound);

                    if (response.AnchorFound)
                    {
                        this.LookForAnchor(response.AnchorId);
                    }
                    else
                    {
                        this.step = DemoStep.Start;
                        this.anchorIdEntry.Hidden = true;
                        this.anchorIdLabel.Hidden = true;
                        this.UpdateMainStatusTitle("Anchor number not found or has expired.");
                    }

                    this.step = DemoStep.LocateAnchor;
                    this.UpdateMainStatusTitle("Locating Anchor..");
                }
            }
        }
        public void OnLocateButtonClicked(object sender, EventArgs args)
        {
            if (this.currentStep == DemoStep.Start)
            {
                this.currentStep   = DemoStep.EnterAnchorNumber;
                this.textView.Text = "Enter an anchor number and press locate";
                this.EnableCorrectUIControls();
            }
            else
            {
                string inputVal = this.anchorNumInput.Text;
                if (!string.IsNullOrEmpty(inputVal))
                {
                    Task.Run(async() =>
                    {
                        RetrieveAnchorResponse response = await this.anchorSharingServiceClient.RetrieveAnchorIdAsync(inputVal);

                        if (response.AnchorFound)
                        {
                            this.AnchorLookedUp(response.AnchorId);
                            //Intent intent = new Intent(this, typeof(AnimalActivity));
                            //intent.PutExtra("anchor", response.AnchorId);
                            //this.StartActivity(intent);
                        }
                        else
                        {
                            this.RunOnUiThread(() =>
                            {
                                this.currentStep = DemoStep.Start;
                                this.EnableCorrectUIControls();
                                this.textView.Text = "Anchor number not found or has expired.";
                            });
                        }
                    });

                    this.currentStep = DemoStep.LocateAnchor;
                    this.EnableCorrectUIControls();
                }
            }
        }
        /* not used */

        public void OnLocateButtonClicked(object sender, EventArgs args)
        {
            if (currentStep == DemoStep.Start)
            {
                currentStep   = DemoStep.EnterAnchorNumber;
                textView.Text = "Enter an anchor number and press locate";
                EnableCorrectUIControls();
            }
            else
            {
                string inputVal = anchorNumInput.Text;
                if (!string.IsNullOrEmpty(inputVal))
                {
                    Task.Run(async() =>
                    {
                        RetrieveAnchorResponse response = await anchorSharingServiceClient.RetrieveAnchorIdAsync(inputVal);

                        if (response.AnchorFound)
                        {
                            AnchorLookedUp(response.AnchorId);
                        }
                        else
                        {
                            RunOnUiThread(() => {
                                currentStep = DemoStep.Start;
                                EnableCorrectUIControls();
                                textView.Text = "Anchor number not found or has expired.";
                            });
                        }
                    });

                    currentStep = DemoStep.LocateAnchor;
                    EnableCorrectUIControls();
                }
            }
        }