void ctrl_UserWantsToEditScore(object sender, SnookerEventArgs e) { var me = App.Repository.GetMyAthlete(); SnookerMatchScore match = e.MatchScore; match.YourName = "Unknown"; if (match.YourAthleteID != me.AthleteID) { App.Navigator.DisplayAlertRegular("Cannot edit someone else's match."); return; } if (match.OpponentConfirmation == OpponentConfirmationEnum.Confirmed) { App.Navigator.DisplayAlertRegular("Cannot edit a confirmed match."); return; } match.YourName = me.Name; match.YourPicture = me.Picture; if (match.OpponentAthleteID > 0) { var person = App.Cache.People.Get(match.OpponentAthleteID); if (person != null) { match.OpponentPicture = person.Picture; } } var page = new RecordMatchPage(match, false); // NewMatch2Page(match, false); App.Navigator.NavPage.Navigation.PushModalAsync(page); }
void ctrl_UserWantsToViewScore(object sender, SnookerEventArgs e) { var me = App.Repository.GetMyAthlete(); SnookerMatchScore match = e.MatchScore; match.YourName = "Unknown"; if (match.YourAthleteID == me.AthleteID) { match.YourName = me.Name; match.YourPicture = me.Picture; } else { var person = App.Cache.People.Get(match.YourAthleteID); if (person != null) { match.YourName = person.Name; match.YourPicture = person.Picture; } } if (match.OpponentAthleteID > 0) { var person = App.Cache.People.Get(match.OpponentAthleteID); if (person != null) { match.OpponentPicture = person.Picture; } } var page = new RecordMatchPage(match, true); // NewMatch2Page(match, true); App.Navigator.NavPage.Navigation.PushModalAsync(page); }
async void ctrl_UserWantsToDeleteScore(object sender, SnookerEventArgs e) { if (this.IsMyAthlete == false) { return; } SnookerMatchScore match = e.MatchScore; bool ok = await App.Navigator.NavPage.DisplayAlert("Byb", "Delete match " + match.ToString() + " ?", "Yes, delete", "Cancel"); if (ok == false) { return; } App.Repository.SetIsDeletedOnScore(match.ID, true); App.Navigator.StartSyncAndCheckForNotifications(); this.loadDataAsyncAndFill(false); }
async void ctrl_UserWantsToDeleteBreak(object sender, SnookerEventArgs e) { if (this.IsMyAthlete == false) { return; } SnookerBreak snookerBreak = e.SnookerBreak; bool ok = await App.Navigator.NavPage.DisplayAlert("Byb", "Delete break " + snookerBreak.ToString() + " ?", "Yes, delete", "Cancel"); if (ok == false) { return; } App.Repository.SetIsDeletedOnResult(snookerBreak.ID, true); App.Navigator.StartSyncAndCheckForNotifications(); this.loadDataAsyncAndFill(false); }
void ctrl_UserWantsToEditBreak(object sender, SnookerEventArgs e) { if (this.IsMyAthlete == false) { return; } SnookerBreak snookerBreak = e.SnookerBreak; if (snookerBreak.OpponentConfirmation == OpponentConfirmationEnum.Confirmed) { App.Navigator.DisplayAlertRegular("Cannot edit a confirmed break."); return; } var page = new RecordBreakPage(snookerBreak, false, true); App.Navigator.NavPage.Navigation.PushModalAsync(page); page.Done += async(s1, e1) => { snookerBreak = e1; if (snookerBreak == null) { return; } // update Result result = App.Repository.GetResult(snookerBreak.ID); result.TimeModified = DateTimeHelper.GetUtcNow(); result.OpponentConfirmation = (int)OpponentConfirmationEnum.NotYet; snookerBreak.PostToResult(result); App.Repository.UpdateResult(result); await App.Navigator.GoToMyProfile(ProfilePersonStateEnum.Breaks, true); App.Navigator.StartSyncAndCheckForNotifications(); }; }