using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rg.Plugins.Popup.Services;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace CafeTerrace.Views.DialogBox
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class FoodCounterDialogBox : ContentView
    {
        public event EventHandler Submited;
        private int FoodCount = 1;
        public FoodCounterDialogBox()
        {
            InitializeComponent();
            countLabel.Text = FoodCount.ToString();
        }

        private void SubmitButton_OnClicked(object sender, EventArgs e)
        {
            Submited?.Invoke(FoodCount , new EventArgs());
        }

        private void PlusButton_OnClicked(object sender, EventArgs e)
        {
            FoodCount++;
            countLabel.Text = string.Empty;
            countLabel.Text = FoodCount.ToString();
        }

        private void MinusButton_OnClicked(object sender, EventArgs e)
        {
            if (FoodCount > 1)
                FoodCount--;
            countLabel.Text = string.Empty;
            countLabel.Text = FoodCount.ToString();
        }
    }
}