private async void imageOpponent_Clicked() { if (Config.App == MobileAppEnum.SnookerForVenues) { return; } if (this.MatchScore.OpponentAthleteID > 0) { string strCancel = "Cancel"; string strPickOther = "Change the opponent"; if (await this.DisplayActionSheet("Byb", strCancel, strPickOther) != strPickOther) { return; } } if (App.Navigator.GetOpenedPage(typeof(PickAthletePage)) != null) { return; } PickAthletePage dlg = new PickAthletePage(); await App.Navigator.NavPage.Navigation.PushModalAsync(dlg); dlg.UserMadeSelection += (s1, e1) => { App.Navigator.NavPage.Navigation.PopModalAsync(); if (e1.Person != null) { this.doOnOpponentSelected(e1.Person); } }; }
private async void buttonAddPerson_Clicked(object sender, EventArgs e) { if (gameHost.When < DateTime.Now) { await this.DisplayAlert("Byb", "This event is in the past. Cannot add players to it.", "OK"); return; } PickAthletePage page = new PickAthletePage(); page.TitleText = "Invite a Player to the Event"; page.ShowUnknown = false; await this.Navigation.PushModalAsync(page); page.UserMadeSelection += (s1, e1) => { this.Navigation.PopModalAsync(); var person = e1.Person; if (person == null) { return; } if (gameHost.IsAthleteIncluded(person.ID)) { this.DisplayAlert("Byb", "This person is already included into this event.", "OK"); return; } Device.BeginInvokeOnMainThread(async() => { if (gameHost.AthleteIDs_Going.Count() >= gameHost.LimitOnNumberOfPlayers) { string increase = "Yes, increase the limit"; if (await this.DisplayActionSheet("Increase the limit on number of players?", "Cancel", null, increase) != increase) { return; } if (await App.WebService.ChangeLimitOnNumberOfPlayers(gameHost.GameHostID, gameHost.LimitOnNumberOfPlayers + 1) == false) { await this.DisplayAlert("Byb", "Couldn't add this player to the event. Internet connection issues?", "OK"); return; } } this.AnythingChanged = true; if (await App.WebService.NewGameHostInvite(gameHost.GameHostID, person.ID, DateTime.Now) == null) { await this.DisplayAlert("Byb", "Couldn't add this player to the event. Internet connection issues?", "OK"); return; } await this.OpenGameHost(gameHost.GameHostID); }); }; }
void opponentClicked() { if (this.metadata.OpponentAthleteID > 0) { if (this.UserMadeSelection != null) { this.UserMadeSelection(this, metadata.OpponentAthleteID); } } else { if (App.Navigator.GetOpenedPage(typeof(PickAthletePage)) != null) { return; } var page = new PickAthletePage(); page.UserMadeSelection += (s1, e1) => { this.Navigation.PopModalAsync(); if (e1 == null || e1.Person == null) { return; } int athleteID = e1.Person.ID; if (athleteID == 0) { return; } if (athleteID == this.metadata.PrimaryAthleteID) { this.DisplayAlert("Byb", "Cannot play against yourself", "OK"); return; } App.Cache.People.Put(e1.Person); if (this.UserMadeSelection != null) { this.UserMadeSelection(this, athleteID); } }; App.Navigator.NavPage.Navigation.PushModalAsync(page); } }
void opponentClicked() { //if (this.PausedMatchMode) // return; if (App.Navigator.GetOpenedPage(typeof(PickAthletePage)) != null) { return; } PickAthletePage dlg = new PickAthletePage(); App.Navigator.NavPage.Navigation.PushModalAsync(dlg); dlg.UserMadeSelection += (s1, e1) => { App.Navigator.NavPage.Navigation.PopModalAsync(); if (e1.Person != null) { this.Metadata.OpponentAthleteID = e1.Person.ID; this.Metadata.OpponentAthleteName = e1.Person.Name; this.Metadata.OpponentPicture = e1.Person.Picture; this.isOpponentMarkedAsUnknown = false; } else if (e1.IsUnknown) { this.Metadata.OpponentAthleteID = 0; this.Metadata.OpponentAthleteName = ""; this.Metadata.OpponentPicture = ""; this.isOpponentMarkedAsUnknown = true; } if (this.OpponentSelected != null) { this.OpponentSelected(this, EventArgs.Empty); } this.fill(); }; }