Beispiel #1
0
        void takePerson(PersonBasicWebModel person)
        {
            if (this.activePlayerStatus == ActivePlayerStatusEnum.PlayerA)
            {
                this.personA = person;
            }
            else
            {
                this.personB = person;
            }

            if (personA == null)
            {
                this.activePlayerStatus = ActivePlayerStatusEnum.PlayerA;
            }
            else if (personB == null)
            {
                this.activePlayerStatus = ActivePlayerStatusEnum.PlayerB;
            }
            else
            {
                this.activePlayerStatus = ActivePlayerStatusEnum.None;
            }

            this.fillPickingAthletesPanel();
        }
Beispiel #2
0
 private void buttonReset_Clicked(object sender, EventArgs e)
 {
     this.personA            = null;
     this.personB            = null;
     this.activePlayerStatus = ActivePlayerStatusEnum.PlayerA;
     this.fillPickingAthletesPanel();
 }
Beispiel #3
0
        void panelB_Clicked()
        {
            if (alertAboutSettingsIfNecessary())
            {
                return;
            }

            this.activePlayerStatus = ActivePlayerStatusEnum.PlayerB;
            this.fillPickingAthletesPanel();
        }
Beispiel #4
0
        async void userTapped(PersonBasicWebModel person, bool justRegistered)
        {
            if (string.IsNullOrEmpty(person.Name))
            {
                return;
            }
            if (this.alertAboutSettingsIfNecessary())
            {
                return;
            }

            if (person == personA)
            {
                this.activePlayerStatus = ActivePlayerStatusEnum.PlayerA;
                this.fillPickingAthletesPanel();
                return;
            }

            if (person == personB)
            {
                this.activePlayerStatus = ActivePlayerStatusEnum.PlayerB;
                this.fillPickingAthletesPanel();
                return;
            }

            if (justRegistered)
            {
                this.takePerson(person);
                return;
            }

            this.labelTitle.Text = "Please wait...";
            bool?hasPin = await App.WebService.HasPin(person.ID);

            this.labelTitle.Text = "";

            if (hasPin == false)
            {
                await this.DisplayAlert(person.Name, "This account does not have a PIN yet. Set the PIN in the 'Snooker Byb' app on your personal mobile device (under the 'Profile' page). Meanwhile you can proceed without the PIN.", "OK");

                this.takePerson(person);
                return;
            }

            if (hasPin == null)
            {
                await this.DisplayAlert("Byb", "No internet connection?", "OK");

                return;
            }

            EnterPinPage enterPinPage = new EnterPinPage(true);

            enterPinPage.TheTitle = person.Name;
            await this.Navigation.PushModalAsync(enterPinPage);

            enterPinPage.UserClickedCancel += () =>
            {
                this.Navigation.PopModalAsync();
            };
            enterPinPage.UserEnteredPin += async() =>
            {
                await this.Navigation.PopModalAsync();

                if (enterPinPage.IsPinOk == false)
                {
                    return;
                }

                this.labelTitle.Text = "Please wait...";
                bool?verified = await App.WebService.VerifyPin(person.ID, enterPinPage.Pin);

                this.labelTitle.Text = "";
                if (verified == false)
                {
                    await this.DisplayAlert("Byb", "Incorrect PIN", "OK");
                }
                else if (verified == null && App.WebService.IsLastExceptionDueToInternetIssues)
                {
                    await this.DisplayAlert("Byb", "Couldn't verify the PIN. Internet connection issues.", "OK");
                }
                else if (verified == null)
                {
                    await this.DisplayAlert("Byb", "Couldn't verify the PIN. Unspecified error.", "OK");
                }
                else
                {
                    this.takePerson(person);
                }
            };
        }