Esempio n. 1
0
        private async void OnDeleteProduct(object sender, EventArgs e)
        {
            bool confirmation = await DisplayAlert("Confirm", "Do you want to delete this product?", "Yes", "No");

            if (!confirmation)
            {
                return;
            }

            Product result = null;

            try
            {
                btnDelete.Text = "Deleting";
                PopupLayout.InputTransparent = true;
                DeletingTextAnimation();
                result = await OnlineDataManager.DeleteProductAsync(SelectedProduct._id);
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", "There was an error deleting the product", "Ok");

                return;
            }
            PopupLayout.InputTransparent = false;

            if (result == null)
            {
                return;
            }

            await DisplayAlert("Done", "Product deleted successfully", "Ok");

            await PopupNavigation.Instance.PopAsync(true);

            await _app.FilterProductsAsync(true);
        }