using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Json; using System.Text; using System.Xml; using System.Xml.Serialization; using Xamarin.Forms; namespace TheGameExtreme.view { [Serializable] public partial class Settings : ContentPage { private bool bSwitchSerialisation; public Settings() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); if(pageContentSetting.BackgroundColor == Color.Black) { swTheme.IsToggled = false; bSwitchSerialisation = swTheme.IsToggled; } else { swTheme.IsToggled = true; bSwitchSerialisation = swTheme.IsToggled; } } 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) { //serialisationSwitch(); await Navigation.PopAsync(); } /*public void serialisationSwitch() { string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "file.xml"); if (!File.Exists(path)) { XmlSerializer ser = new XmlSerializer(typeof(bool)); using (StreamWriter sw = File.CreateText(path)) { sw.WriteLine(swTheme.IsToggled); } } }*/ } }