using System;
using Pixiview.Utils;
using Xamarin.Forms;

namespace Pixiview
{
    public partial class AppShell : Shell
    {
        public static new AppShell Current => Shell.Current as AppShell;

        public static Thickness NavigationBarOffset { get; private set; }
        public static Thickness TotalBarOffset { get; private set; }

        public event EventHandler<BarHeightEventArgs> NavigationBarHeightChanged;

        public AppShell()
        {
            InitializeComponent();

            App.DebugPrint($"folder: {Stores.PersonalFolder}");
        }

        public void SetNavigationBarHeight(double height, double statusHeight)
        {
            NavigationBarOffset = new Thickness(0, height, 0, 0);
            TotalBarOffset = new Thickness(0, height + statusHeight, 0, 0);

            NavigationBarHeightChanged?.Invoke(this, new BarHeightEventArgs
            {
                NavigationBarHeight = height,
                StatusBarHeight = statusHeight
            });
        }
    }

    public class BarHeightEventArgs : EventArgs
    {
        public double NavigationBarHeight { get; set; }
        public double StatusBarHeight { get; set; }
    }
}
