using System;
using System.Collections.Generic;

using Xamarin.Forms;

namespace TheGameExtreme.view
{
    public partial class Settings : ContentPage
        
    {
          
        public Settings()
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);
            if(pageContentSetting.BackgroundColor == Color.Black)
            {
                swTheme.IsToggled = false;
            }
            else
            {
                swTheme.IsToggled = true;
            }

            
            


        }

        private void CBBr_CheckedChanged(object sender, CheckedChangedEventArgs e)
        {
            if (CBBr.IsChecked == true)
            {
                CBFr.IsChecked = false;
              
            }
            else if(CBBr.IsChecked == false)
            {
                CBFr.IsChecked = true;
                
            }
           

                          
            
        }

        private void CBFr_CheckedChanged(object sender, CheckedChangedEventArgs e)
        {
            if (CBFr.IsChecked == true)
            {
                CBBr.IsChecked = false;
                
            }
            else if (CBFr.IsChecked == false)
            {
                CBBr.IsChecked = true;
            }
        }     

        private void Switch_Toggled_Theme(object sender, ToggledEventArgs e)//Change le background color de settings en noir et swap la couleur des labels en blanc
        {
            
            if (swTheme.IsToggled == false)
            {
                Application.Current.Resources["BlackColor"] = Color.Black;
                Application.Current.Resources["WhiteColor"] = Color.White;
                Application.Current.Resources["SkyBlueColor"] = Color.SkyBlue;
                
                
            }
            else
            {
                Application.Current.Resources["BlackColor"] = Color.White;
                Application.Current.Resources["WhiteColor"] = Color.Black;
                Application.Current.Resources["BlueSkyColor"] = Color.SkyBlue;
            }
        }       

        private async void SettingToHomePage(object sender, EventArgs e)
        {
            await Navigation.PopAsync();        
        }
    }
}
