using PlantBox.Client.Forms;
using PlantBox.Client.Resources;
using PlantBox.Client.ViewModels;
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace PlantBox.Client
{
    public partial class App : Application
    {
        public static SettingsViewModel Settings { get; private set; }
        public static MainPage MasterPage { get; private set; }

        public App()
        {
            InitializeComponent();

            // Load settings
            Settings = (SettingsViewModel)Resources["Settings"];

            if (Settings.Language != null)
            {
                Locale.Culture = Settings.Language;
            }

            MasterPage = new MainPage();
            MainPage = MasterPage;
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
            Settings.Save();
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}
