예제 #1
0
#pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        private async void GetCoupons()
#pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void
        {
            try
            {
                Config.ShowDialog();
                if (!CrossConnectivity.Current.IsConnected)
                {
                    await DisplayAlert("Alert", "Your device is not connected to internet. Please try again later.",
                                       "Ok");
                }
                else
                {
                    var response = await CategoryLogic.CouponList();

                    if (response.status == 200)
                    {
                        Config.HideDialog();
                        listCoupons.ItemsSource = response.data;
                    }
                    else
                    {
                        Config.HideDialog();
                        EmptyCoupons();
                        //await DisplayAlert("Alert", response.message, "Ok");
                    }
                }
            }
            catch
            {
                Config.HideDialog();
                EmptyCoupons();
                await DisplayAlert("Alert", Config.ApiErrorMessage, "Ok");
            }
        }