Beispiel #1
0
        public async Task StartProgressBar(string url)
        {
            bool rate = Preferences.Get("rate", true);

            if (Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.Internet)
            {
                Device.BeginInvokeOnMainThread(async() =>
                                               await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorNoInternet, "OK"));
                return;
            }

            // Loading settings
            Configurations.LoadingConfig = new LoadingConfig
            {
                IndicatorColor = (Color)Application.Current.Resources["MainColor"],
                OverlayColor   = Color.Black,
                Opacity        = 0.6,
                DefaultMessage = "Оплата",
            };

            await Loading.Instance.StartAsync(async progress =>
            {
                // some heavy process.
                PayResult result = await server.GetPayResult(url);
                if (result.error != null && result.Equals(""))
                {
                    await DisplayAlert(AppResources.ErrorTitle, result.error, "OK");
                    try
                    {
                        _ = await Navigation.PopAsync();
                    }
                    catch { }
                }
                else
                {
                    await Navigation.PopToRootAsync();

                    await DisplayAlert(AppResources.AlertSuccess, result.message, "OK");
                    if (rate)
                    {
                        await PopupNavigation.Instance.PushAsync(new RatingAppMarketDialog());
                    }
                    if (idRequset != null)
                    {
                        await GetCodePay();
                    }
                }
            });
        }