using inutralia.Views;
using System;
using System.Collections.Generic;

using Xamarin.Forms;

namespace inutralia.Views
{
	public partial class MenuView : ContentPage
	{
		public MenuView()
		{
			InitializeComponent();
            btnHome.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => onBtnHomeClicked())
            });

            btnLoginOut     .GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => onLoginOutClicked())
            });;
            btnMyMenu       .GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => onBtnMyMenuClicked())
            });;
            btnMyProfile    .GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => onBtnMyProfileClicked())
            });;
            btnRecipeBook   .GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => onBtnRecipeBookClicked())
            });;  
            btnShoppingList.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => onBtnShoppingListClicked())
            }); ;

            btnGenericMenus.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => onBtnGenericMenusClicked())
            }); ;
        }

        void onBtnHomeClicked()
        {
            //await (App.Current.MainPage as MasterDetailPage).Detail.Navigation.PopToRootAsync();
            (App.Current.MainPage as RootPage).Navigate<HomeView>();
        }

        void onBtnMyMenuClicked()
        {
            (App.Current.MainPage as RootPage).Navigate<CustomMenuView>();
        }
        void onBtnMyProfileClicked()
        {
            (App.Current.MainPage as RootPage).Navigate<ProfileView>();
        }
        void onBtnRecipeBookClicked()
        {
            (App.Current.MainPage as RootPage).Navigate<RecipeListView>();
        }

        void onBtnGenericMenusClicked()
        {
            (App.Current.MainPage as RootPage).Navigate<GenericListView>();
        }
        void onBtnShoppingListClicked()
        {
            (App.Current.MainPage as RootPage).Navigate<ShoppingListView>();
        }
        void onLoginOutClicked()
        {
            App.IsUserLoggedIn = false;
        }

    }
}
