/// <summary> /// /// </summary> public async static Task DestroiWaitPage(bool FiniskAllPopUps) { try { var CollectionPoupStack = Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopupStack; if (CollectionPoupStack.Any()) { if (FiniskAllPopUps) { PopAllPopUoAsybc(); } else { if (waitPage != null) { Device.BeginInvokeOnMainThread(async() => { await GetCurrentPage().Navigation.RemovePopupPageAsync(waitPage, false); waitPage = null; }); } else { PopAllPopUoAsybc(); } } } } catch { } }
public async static Task CreateWaitPage(Color color, string Descricao) { try { if (waitPage == null) { waitPage = new WaitPage(color, Descricao); Device.BeginInvokeOnMainThread(async() => { await GetCurrentPage().Navigation.PushPopupAsync(waitPage); }); await Task.Delay(1000); } else { if (waitPage != null && !waitPage.Mensagem.Equals(Descricao)) { Device.BeginInvokeOnMainThread(() => { waitPage.Mensagem = Descricao; }); } } } catch { } }
public Project78Page() { BindingContext = viewModel = new DeclarationsViewModel(); InitializeComponent(); Title = "Declarations"; ToolbarItems.Add(new ToolbarItem("Add", null, async() => { var wait = new WaitPage(); var photo = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions() { CompressionQuality = 70, PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium }); if (photo != null) { await Navigation.PushAsync(wait); var resizedImage = await CrossImageResizer.Current.ResizeImageWithAspectRatioAsync(await StreamToByteArrayAsync(photo.GetStream()), 1080, 1920); try { var response = await APIService.Instance.PostImageAsync(new ByteArrayContent(resizedImage), GenerateFileName()); await Navigation.PushAsync(new DetailedDeclarationPage(response)); } catch (Exception e) { Debug.WriteLine(e.ToString()); await DisplayAlert("Oops!", "We have encountered a problem!", "Ok"); } Navigation.RemovePage(wait); photo.Dispose(); } })); }
private static void PopAllPopUoAsybc() { Device.BeginInvokeOnMainThread(async() => { await GetCurrentPage().Navigation.PopAllPopupAsync(false); waitPage = null; }); }