using System; using Xamarin.Forms; using TheGameExtreme.IO; namespace TheGameExtreme.view { public partial class HomePage : ContentPage { public HomePage() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); LoadParameterOptionOnHomepage(); } private async void OpenGame(object sender, EventArgs args) { await Navigation.PushAsync(new GamePreparationPage()); } private async void OpenMultiPlayerMode(object sender, EventArgs args) { await DisplayAlert("Mode en cours de développement", null, "Fermer"); //await Navigation.PushAsync(new MultiPlayerMode()); } private async void Rules_Clicked(object sender, EventArgs args) { await Navigation.PushAsync(new RulesGame()); } public void LoadParameterOptionOnHomepage() { bool b = IOOptions.LoadOptionsParameter(); if (!b) { Application.Current.Resources["BlackColor"] = Color.Black; Application.Current.Resources["WhiteColor"] = Color.White; imageButton.Source = "SoleilThemes.png"; } else { Application.Current.Resources["BlackColor"] = Color.White; Application.Current.Resources["WhiteColor"] = Color.Black; imageButton.Source = "LuneSombreTheme.png"; } } private void Theme_Clicked(object sender, EventArgs e) { bool b; ButtonGrid.Children.Remove(imageButton); if(homepageT.BackgroundColor == Color.Black) { b = true; Application.Current.Resources["BlackColor"] = Color.White; Application.Current.Resources["WhiteColor"] = Color.Black; imageButton = new ImageButton() { BackgroundColor = Color.Transparent, BorderColor = (Color)Application.Current.Resources["SkyBlueColor"] }; imageButton.Source = "LuneSombreTheme.png"; } else { b = false; Application.Current.Resources["BlackColor"] = Color.Black; Application.Current.Resources["WhiteColor"] = Color.White; imageButton = new ImageButton() { BackgroundColor = Color.Transparent, BorderColor = (Color)Application.Current.Resources["SkyBlueColor"] }; imageButton.Source = "SoleilThemes.png"; } ButtonGrid.Children.Add(imageButton, 1, 1); imageButton.Clicked += Theme_Clicked; imageButton.HorizontalOptions = LayoutOptions.Center; imageButton.VerticalOptions = LayoutOptions.End; IOOptions.SaveOptionParameter(b); } } }