protected async Task openWaitPage() { if (this.waitPage != null) { return; } this.waitPage = new PleaseWaitPage(); await App.Navigator.NavPage.Navigation.PushModalAsync(this.waitPage); }
protected async Task closeWaitPage() { if (waitPage == null) { return; } await App.Navigator.NavPage.Navigation.PopModalAsync(true); this.waitPage = null; }
async void register(string pin, string name, string email) { PleaseWaitPage pleaseWaitPage = new PleaseWaitPage(); await this.Navigation.PushModalAsync(pleaseWaitPage); string password = pin; if (password == null) { password = ""; } // register var config = FVOConfig.LoadFromKeyChain(App.KeyChain); int?athleteID = await App.WebService.RegisterFVO(email, password, name, config.VenueID); if (athleteID == null) { await this.Navigation.PopModalAsync(); await App.Navigator.DisplayAlertErrorAsync("Could not register. Internet issues? Already registered?"); return; } this.Clear(); // load the athlete record var athlete = await App.WebService.GetPersonByID(athleteID.Value); if (athlete == null) { await this.Navigation.PopModalAsync(); await App.Navigator.DisplayAlertErrorAsync("Unspecified error. Internet issues?"); return; } await this.Navigation.PopModalAsync(); if (this.UserRegistered != null) { this.UserRegistered(athlete); } }
async void buttonOk_Clicked(object sender, EventArgs e) { if (await this.DisplayAlert("Byb", "Information correct?", "Yes, correct", "Cancel") != true) { return; } VenueEditWebModel edit = new VenueEditWebModel(); edit.VenueID = Venue.ID; if (this.picker10fTables.SelectedIndex >= 0) { edit.NumberOf10fSnookerTables = this.picker10fTables.SelectedIndex; } if (this.picker12fTables.SelectedIndex >= 0) { edit.NumberOf12fSnookerTables = this.picker12fTables.SelectedIndex; } edit.PhoneNumber = this.entryPhone.Text; edit.Website = this.entryWebsite.Text; edit.Address = this.entryAddress.Text; edit.IsInvalid = !this.switchValidVenue.IsToggled; PleaseWaitPage waitPage = new PleaseWaitPage(); await App.Navigator.NavPage.Navigation.PushModalAsync(waitPage); bool ok = await App.WebService.VerifyOrEditVenue(edit); await App.Navigator.NavPage.Navigation.PopModalAsync(); if (ok == false) { await DisplayAlert("Byb", "Couldn't post this to the web service. Internet issues?", "OK"); return; } // update the venue in the Cache var updatedVenue = await App.WebService.GetVenue(Venue.ID); App.Cache.Venues.Put(updatedVenue); // let other pages know App.Navigator.DoOnVenueEdited(Venue.ID); }
async void changePin(string newPin) { PleaseWaitPage pleaseWaitPage = new PleaseWaitPage(); await App.Navigator.NavPage.Navigation.PushModalAsync(pleaseWaitPage); var result = await App.WebService.ChangePin(newPin); await App.Navigator.NavPage.Navigation.PopModalAsync(); if (result == null) { await App.Navigator.NavPage.DisplayAlert("Byb", "Couldn't update PIN. Internet issues?", "OK"); } else if (result.PinChanged == false) { await App.Navigator.NavPage.DisplayAlert("Byb", "Error. Couldn't update PIN.", "OK"); } else { this.labelPin.Text = "X X X X"; // remember the new PIN App.KeyChain.PinCode = newPin; // remember the new PIN as the new password if (result.PasswordChanged) { App.KeyChain.Add(athlete.UserName, newPin); } if (result.PasswordChanged == true) { await App.Navigator.NavPage.DisplayAlert("Byb", "Done. Your password and your PIN are now updated. Use this PIN on public Snooker Byb scoreboards to access your account.", "OK"); await App.LoginAndRegistrationLogic.ShowReloginPage(); } else { await App.Navigator.NavPage.DisplayAlert("Byb", "Done. Use this PIN on public Snooker Byb scoreboards to access your account.", "OK"); await App.LoginAndRegistrationLogic.ShowReloginPage(); } } }
private async void buttonOk_Clicked(object sender, EventArgs e) { string text = this.editorText.Text; if (text == null) { text = ""; } if (text.Length > 512) { text = text.Substring(0, 512); } if (text.Length == 0) { await this.DisplayAlert("Byb", "Enter something to post.", "OK"); return; } // open "please wait" PleaseWaitPage pleaseWaitPage = new PleaseWaitPage(); await App.Navigator.NavPage.Navigation.PushModalAsync(pleaseWaitPage); // send a request to the cloud int?postID = await App.WebService.MakePost(this.country.ThreeLetterCode, metroID, text); this.Posted = true; // close "please wait" await App.Navigator.NavPage.Navigation.PopModalAsync(); if (postID == null) { await App.Navigator.DisplayAlertErrorAsync("Couldn't post. Internet issues?"); return; } // close this dialog await App.Navigator.NavPage.Navigation.PopModalAsync(); }
public async void CheckNotificationsAndOpenNotificationsPage() { PleaseWaitPage pleaseWaitPage = new PleaseWaitPage(); pleaseWaitPage.StatusText = "Loading notifications."; pleaseWaitPage.ShowCancelButton = true; await NavPage.Navigation.PushAsync(pleaseWaitPage); pleaseWaitPage.CancelButtonClicked += (s1, e1) => { NavPage.Navigation.PopAsync(); pleaseWaitPage = null; }; notificationsService.CheckForNotifications((s1, e1) => { if (pleaseWaitPage == null) { return; } NavPage.Navigation.PopAsync(); OpenNotificationsPage(); }); }
public void OpenNewsfeedItemPage(int commentID) { PleaseWaitPage pleaseWaitPage = new PleaseWaitPage(); pleaseWaitPage.StatusText = "Loading."; pleaseWaitPage.ShowCancelButton = true; NavPage.Navigation.PushModalAsync(pleaseWaitPage); pleaseWaitPage.CancelButtonClicked += (s1, e1) => { NavPage.Navigation.PopModalAsync(); pleaseWaitPage = null; }; Task task = new Task(async() => { var item = await App.WebService.GetNewsfeedItemFromCommentID(commentID); Device.BeginInvokeOnMainThread(async() => { // close the wait page await NavPage.Navigation.PopModalAsync(); // open newsfeed item page if (item == null) { await this.GoToCommunity(); } else { NewsfeedItemPage page = new NewsfeedItemPage(item, true); await NavPage.Navigation.PushModalAsync(page); } }); }); task.Start(); }
public void Fill(List <CommentWebModel> comments) { this.Children.Clear(); if (comments == null) { this.Children.Add(new BybLabel() { Text = "Couldn't load comments. Internet issues?", TextColor = Config.ColorBlackTextOnWhite, }); return; } if (comments.Count == 0) { //this.Children.Add(new BybLabel() //{ // Text = "No comments", //}); return; } comments = comments.OrderBy(i => i.Time).ToList(); foreach (var comment in comments) { FormattedString formattedString = new FormattedString(); formattedString.Spans.Add(new Span() { Text = DateTimeHelper.DateToString(comment.Time), ForegroundColor = Config.ColorTextOnBackgroundGrayed, FontSize = Config.SmallFontSize }); formattedString.Spans.Add(new Span() { Text = " " + comment.AthleteName, ForegroundColor = Config.ColorBlackTextOnWhite }); var label = new BybLabel() { FormattedText = formattedString, TextColor = Config.ColorGrayTextOnWhite, FontSize = Config.SmallFontSize }; label.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(async() => { await App.Navigator.GoToPersonProfile(comment.AthleteID); }), NumberOfTapsRequired = 1 }); var panel = new StackLayout() { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.White, Padding = new Thickness(0, 3, 0, 3), Children = { new Frame { BackgroundColor = Color.White, Padding = new Thickness(0), Content = new Image() { Source = App.ImagesService.GetImageSource(comment.AthletePicture, BackgroundEnum.White), WidthRequest = Config.PersonImageSize / 2, HeightRequest = Config.PersonImageSize / 2, } }, new StackLayout { Orientation = StackOrientation.Vertical, Children = { label, new BybLabel { Text = comment.Text, TextColor = Config.ColorBlackTextOnWhite, }, } }, } }; this.Children.Add(panel); panel.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(async() => { if (comment.AthleteID != App.Repository.GetMyAthleteID()) { return; } if (await App.Navigator.NavPage.DisplayAlert("Your comment", "Do you want to delete this comment?", "Delete", "Cancel") != true) { return; } PleaseWaitPage waitPage = new PleaseWaitPage(); await App.Navigator.NavPage.Navigation.PushModalAsync(waitPage); bool ok = await App.WebService.DeleteComment(comment.ID); await App.Navigator.NavPage.Navigation.PopModalAsync(); if (ok == false) { App.Navigator.DisplayAlertRegular("Failed to delete the comment"); } else { comments.Remove(comment); this.Fill(comments); } }) }); } }