コード例 #1
0
        public async Task CloseLastPopup()
        {
            if (Device.RuntimePlatform == "Test")
            {
                IsShowing = false;
                return;
            }

            if (_popupNavigation.PopupStack.Any())
            {
                await _popupNavigation.PopAsync();
            }

            IsShowing = false;
        }
コード例 #2
0
        public async Task <bool> Close(bool animated = true)
        {
            var count = _popupNavigationService.PopupStack.Count;
            await _popupNavigationService.PopAsync(animated);

            return(_popupNavigationService.PopupStack.Count < count);
        }
コード例 #3
0
 public static async Task PopPopupAsyncSafe(this INavigation sender, IPopupNavigation popupNavigation, bool animate = true)
 {
     if (Device.RuntimePlatform == "Test")
     {
         return;
     }
     await popupNavigation.PopAsync(animate);
 }
コード例 #4
0
        public static async Task <EditQuantityResponse> Show(IPopupNavigation navigator, int Current, int Min = 1, int Max = 300)
        {
            var view = new EditQuantityView(Current, Min, Max);
            await navigator.PushAsync(view);

            var result = await view.GetResult();

            await navigator.PopAsync();

            return(result);
        }
コード例 #5
0
        /**
         * intancia de la clase
         * retorana un folio result, muestra el modal.
         */
        public static async Task <FolioResult> Show(IPopupNavigation navigator)
        {
            var view = new vwPopupFolio();
            await navigator.PushAsync(view);

            var result = await view.GetResult();

            await navigator.PopAsync();

            return(result);
        }
コード例 #6
0
        /**
         * intancia de la clase
         * retorana un folio result, muestra el modal.
         */
        public static async Task <bool> Show(IPopupNavigation navigator, List <string> phrases, string FOLIO)
        {
            var view = new vwPopupCOVIDSurvey(phrases, FOLIO);
            await navigator.PushAsync(view);

            var result = await view.GetResult();

            await navigator.PopAsync();

            return(true);
        }
コード例 #7
0
        public static async Task <PromotionalCodeResult> Show(IPopupNavigation navigator, InternetService internetService, double Total)
        {
            var view = new PromotionalCodeView(internetService, Total);
            await navigator.PushAsync(view);

            var result = await view.GetResult();

            await navigator.PopAsync();

            return(result);
        }
コード例 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="navigator"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static async Task <bool> Show(IPopupNavigation navigator, string username, string password, bool multiple = false)
        {
            var view = new PayNotificationView(username, password, multiple);
            await navigator.PushAsync(view);

            var result = await view.GetResult();

            await navigator.PopAsync();

            return(true);
        }
コード例 #9
0
 /// <summary>
 /// Остановка анимации ожидания с указанным идентификатором
 /// </summary>
 /// <param name="guid">Идентификатор анимации</param>
 public void StopAnimation(Guid guid) =>
 Device.BeginInvokeOnMainThread
 (
     () =>
 {
     if (_messages.ContainsKey(guid))
     {
         _messages.Remove(guid);
         if (_messages.Count == 0)
         {
             if (_popupNavigation.PopupStack.Count == 1)
             {
                 _popupNavigation.PopAsync().ConfigureAwait(true);
             }
         }
         else
         {
             _waitingAnimationPage.Message = _messages.Last().Value;
         }
     }
 }
 );
コード例 #10
0
        private async void EnlargeImage()
        {
            var page = (PopupPage) new ImagePopupPage();
            var tapGestureRecognizer = new TapGestureRecognizer();

            tapGestureRecognizer.Tapped += (s, e) => {
                _popupNavigation.PopAsync(true);
            };
            var image = new Image()
            {
                Source = $"{ItemSelected.ImageSource}"
            };

            image.GestureRecognizers.Add(tapGestureRecognizer);
            page.Content = new StackLayout()
            {
                Children          = { image },
                Padding           = 10,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center
            };

            await _popupNavigation.PushAsync(page, true);
        }
コード例 #11
0
 private async void CrearCita_Clicked(object sender, EventArgs e)
 {
     await navigation.PopAsync();
 }
コード例 #12
0
 /// <summary>
 /// Pop from popup stack.
 /// </summary>
 /// <param name="all"></param>
 /// <returns></returns>
 public Task Pop(bool all = false)
 {
     return(all ? popupNavigation.PopAllAsync() : popupNavigation.PopAsync());
 }
コード例 #13
0
 /// <inheritdoc/>
 public IObservable<Unit> PopPopup(bool animate = true) =>
     Observable.FromAsync(() => _popupNavigation.PopAsync(animate));
コード例 #14
0
 public async Task DismissPopupAsync() => await popupNavigation.PopAsync();
コード例 #15
0
        public RecipeViewModel(INavigation navigation, IUserDialogs dialogs, IPopupNavigation popupNavigation, IApiService apiService)
        {
            _apiService = apiService;
            Navigation  = navigation;
            Dialogs     = dialogs;
            bool canFetchRecipes = false;

            FetchRecipesCommand = new Command(async() =>
            {
                CanInitiateNewFetchRecipes(false);
                try
                {
                    Dialogs?.ShowLoading("Fetching recipes for you...");
                    if (Connectivity.NetworkAccess == NetworkAccess.Internet)
                    {
                        try
                        {
                            if (PageSize == 100) //max page size reached
                            {
                                Dialogs?.HideLoading();
                                await Dialogs?.AlertAsync("The end of the list has been reached :(", "Notice", "OK");
                                return;
                            }
                            var RecipesRetrieved = await _apiService.GetAllRecipes(PageSize);
                            if (RecipesRetrieved != null)
                            {
                                if (RecipesRetrieved.results.Count > 0)
                                {
                                    foreach (var data in RecipesRetrieved.results)
                                    {
                                        AllRecipes.Add(data);
                                    }
                                }
                                PageSize++;
                                Items = (AllRecipes.Count) - 1;
                                Dialogs?.HideLoading();
                            }
                            else
                            {
                                Dialogs?.HideLoading();
                                await Dialogs?.AlertAsync("No data found!. Please try again later.", "Error", "OK");
                            }
                        }
                        catch (ApiException ex)
                        {
                            Dialogs?.HideLoading();
                            popupNavigation?.PopAsync();
                            await Dialogs?.AlertAsync(ex.Content, ex.Name, "OK");
                        }
                        catch (Exception ex)
                        {
                            Dialogs?.HideLoading();
                            await Dialogs?.AlertAsync("An unexpected error has occurred. Please try again.", "Error", "OK");
                            Debug.WriteLine(ex);
                        }
                    }
                    else
                    {
                        Dialogs?.HideLoading();
                        popupNavigation?.PopAsync();
                        await Dialogs?.AlertAsync("You seem to be offline. Please connect to the Wi-Fi and try again.", "Error", "OK");
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                    Dialogs?.HideLoading();
                }
                CanInitiateNewFetchRecipes(true);
            }, () => canFetchRecipes);


            void CanInitiateNewFetchRecipes(bool value)
            {
                canFetchRecipes = value; ((Command)FetchRecipesCommand).ChangeCanExecute();
            }
        }
コード例 #16
0
 public virtual async Task PopAsync()
 {
     await _popupNavigation.PopAsync().ConfigureAwait(false);
 }